On 3/12/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 3/12/07, Chas Owens <[EMAIL PROTECTED]> wrote:
> The key here is "zero-width".  These constructs do not consume any
> characters, so they must be combine with patterns that do:
>
> /^FOO(?!BAR).*?(BAZ)(?!BAR).*BAR/
>

However, this will only work if BAR directly follows FOO.  This string
will still match:

FOO BAR BAZ 8 BAR


Bringing the anchors into the zero-width look ahead seems to solve that problem.

/^FOO(?!.*?BAR.*?BAZ).*?(BAZ)(?!.*?BAR.*?BAR).*BAR/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to