I'm trying to match a pattern only when it occurs between matching delimiters
For example, in the lines below, I'd like to match the a in the first line, but not the a in the second, which is not inside matching parens
( a )
( b ) a ( b )
The command
:g/(.*a.*)/s/a/A/
obviously doesn't work because it's too greedy.
I would have thought the non-greedy alternative
g/(\{-}a\{-})/s/a/A/
would work, but for some reason it returns
( A )
( b ) A ( b )
Obviously, I don't really understand how the non-greedy syntax works. Any suggestions would be most appreciated! Thanks
editbutton under your question is for: You can click it and modify your question to append some informations which could be useful. That's why the comments are not convenient to write complexes explications :-) If you created a new question try not to make a duplicate of this one. I'll give a look a your new question and see if I can find an answer. – statox Oct 01 '15 at 03:49