On 3/12/07, Dave Cardwell <[EMAIL PROTECTED]> wrote:
Hello there, I'm having trouble constructing a regular expression that
would do the following:

FOO...
...followed by anything but BAR (non-greedy)...
...followed by BAZ (captured)...
...followed by anything but BAR (greedy)...
...followed by BAR

I've been looking at zero-width negative look-ahead, but I haven't used
this area of regular expressions before so I'm struggling. A solution or
prod in the right direction would be lovely.
snip

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/

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


Reply via email to