in reply to regex grouping issue

Something you might wish to consider is the restructuring of the logic to take advantage of DeMorgan's Laws, which I found myself using the other day on a particularly funky regex at work.

Essentially, DeMorgan's Laws in my own words are

DeMorgan's Laws:
The compliment of a conjunction is the disjunction of the compliments.
and
The compliment of a disjunction is the conjunction of the compliments.

In other words, not(P and Q) = (not-P or not-Q), et vice versa.

In my application, rather than using alternate lists of certain characters with positive lookarounds, I looked for the match text to have none of the characters with the negative lookarounds. (Which is an "AND" condition, and much easier to perform in my case.)

Hope this helped a little,
-v.

"Perl. There is no substitute."