Regular expression, "not this string"

2007-03-12 Thread Dave Cardwell
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-ahe

Re: Regular expression, "not this string"

2007-03-12 Thread Chas Owens
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 B

Re: Regular expression, "not this string"

2007-03-12 Thread Chas Owens
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 m

Re: Regular expression, "not this string"

2007-03-12 Thread Chas Owens
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 wo

Re: Regular expression, "not this string"

2007-03-12 Thread Rob Dixon
Dave Cardwell 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

Re: Regular expression, "not this string"

2007-03-12 Thread Dave Cardwell
Chas Owens wrote: 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

Re: Regular expression, "not this string"

2007-03-12 Thread Dave Cardwell
Rob Dixon wrote: Dave Cardwell 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 be

Re: Regular expression, "not this string"

2007-03-12 Thread Rob Dixon
Dave Cardwell wrote: Rob Dixon wrote: Dave Cardwell 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)... ...foll

Re: Regular expression, "not this string"

2007-03-12 Thread Dave Cardwell
Rob Dixon wrote: Dave Cardwell wrote: Rob Dixon wrote: Dave Cardwell 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 (