Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-05-01 05:17:18


Roger Leigh wrote:
>> Hi folks,
>>
>> The following code demonstrates the problem I'm having. I'm using
>> Boost 1.33.1 (Debian), but IIRC this worked last year with the same
>> version because I tested it; possibly a Debian-specific regression?

> I expect both regular expressions here to match with the value string.
> They certainly to with egrep. However, I only get the second to
> match:
>
> % g++ -c regex.cc -o regex.o && g++ -o regex regex.o -lboost_regex
> % ./regex
> It didn't match the first
> It matched the second
>
> Am I correct in my expectation that expression1 will match? If not,
> what should I be doing to make it match?

Use regex_search. regex_match will only succeed if the expression matches
*all* of the string, regex_search will *find* a sub-string that matches.

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