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 )
obviously doesn't work because it's too greedy.
I would have thought the non-greedy alternative
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