in reply to Re^3: Match a pattern only if it is not within another pattern
in thread Match a pattern only if it is not within another pattern

Just remove the ? from .+? to make it greedy and it will work.
  • Comment on Re^4: Match a pattern only if it is not within another pattern