Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-02-08 12:48:48


> // I would expect this to not match due to the 'w'.
> // Why does it match?
> cout << regex_match("\xF8p\x2Aqfw\x0DPFFF", reg_exp) << endl;

I believe the \x2A character is a '*' right?

If so the compiler converts \x2A to a * so the regex engine sees a ".*".

If you double up those escapes and use "\\x2A" then the regex engine will
parse the escape rather than the compiler, and so it won't be interpreted as
a quantifier anymore.

This one had me fooled for a while BTW ;-)

John.


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