Don't ask to ask, just ask | |
PerlMonks |
Re: regex grouping issueby Velaki (Chaplain) |
on Sep 01, 2006 at 10:40 UTC ( [id://570747]=note: print w/replies, xml ) | Need Help?? |
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
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,
"Perl. There is no substitute."
In Section
Seekers of Perl Wisdom
|
|