in reply to Re^3: Zero-width look-ahead regexp question
in thread Zero-width look-ahead regexp question
"it is surprising how a glass of Italian Chardonnay can do good to the brain cells"
But it is far from surprising that providing a clear specification of what you seek will enhance the liklihood that the Monks will provide useful advice.
I mention this because your original post. The first bit of code, [/^(BAR|BAZ)$/, requires that /BA[RZ]/ NOT be the last element of your string, while the second, the negative lookahead, (?!(BAR|BAZ)).*$/, allows anything NOT /BA[RZ]/ followed by (your dot_deathstar, .* any number of any characters INCLUDING /BA[RZ]/.
Judging by other replies, I wasn't the only one confounded thereby. yet very shortly after your clarifying example (in this node's parent) you got a reasonably general answer from Anonymonk (and re that answer, I'm not sure I buy the advice to "avoid as the plague the use of capturing groups in the decomposed regexes..." but the thought process outlined in that node deserves a ++ ((and got same from me)).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Zero-width look-ahead regexp question
by rovf (Priest) on Jul 02, 2008 at 07:02 UTC |