in reply to Match a pattern only if it is not within another pattern
I believe the general case for this problem would be relatively trivial to do with lookahead and lookbehind, *if* variable length negative lookbehind was supported, which PCRE currently does not. However, like so many other things, this is supposed to be fixed in perl6. It would be nice to have a Parse::Recdescent solution for this, since this is the closest thing perl5 has to perl6 rules.