|
Boost Users : |
From: Yutaka Emura (yutaka_at_[hidden])
Date: 2003-02-17 14:02:34
Hi John
"(?!foo)bar" matches "bar" in the last three lines of the following:
foobar
??bar
barfoo
bar??
bar
Why doesn't it match "bar" in all the lines?
Yutaka Emura
---------------
> I am using RegEx in Boost v1.29.0.
> (?= ) and (?! ) expressions do not seem to work at a certain
> condition.
>
> In the following example, "(?=a)b" should match "b" in "xyzabcdefg",
> but does not.
Which is correct: (?=a) is a forward lookahead *possitive* assertion, so
(?=a)b can never match anything since the next character can't be both
an
'a' and a 'b' at the same time!
> Similarly, "(?!a)b" should not match "b" in "xyzabcdefg" but it does.
It should match: (?!a) will match anything except 'a' so (?!a)b will
match
the next 'b' that it finds.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net