At my company we have the code convention to write $foo . $bar (with whitespaces). Because I couldn't get familiar with that (I don't want to discuss :P ), I wrote the following vim-replace-function:
:%s/\(\w\|\]\|'\|\"\)\s\?\.\s\?\('\|\$\|\"\|(\)/\1 \. \2/eg
..which matches everything I needed so far. But now I also have String which I don't want to replace.
So how can I ignore Strings like "foo.bar" or 'foo.bar', but not $foo.$bar ?
Update: I would also be happy with a completely scripted function. I just wonder if there is no other way than temporarily remove all php-strings. Re-calculating the actual replacement-positions would be a mess, no?