I'm currently fighting with regex to achieve something and can't success by myself ...
Here my string: path/to/folder/@here
What I want is something like this: a:path/a:to/a:folder/@here
So my regex is the following one : /([^\/]+)/g
, but the problem is that the result will be (preg_replace('/([^\/@]+)/', 'a:$0'
): a:path/a:to/a:folder/a:@here
...
How can I had skip the replace if the captured group contains @
?
I tried this one, without any success : /((?!@)[^\/]+)/g