Boost logo

Boost :

From: Robert Mathews (rmathews_at_[hidden])
Date: 2005-05-20 15:59:18


"John Maddock" <john_at_[hidden]> wrote in message
news:022901c55616$1b2bed20$030e1452_at_fuji...
> I noticed some surprising behavior with match_partial and regex_search.
> Consider:
>
> regex e("abc|b");
> string str("ab");
> smatch what;
> if(regex_search(str, what, e, match_default | match_partial))
> {
> cout << (what[0].matched ? "full" : "partial") << '\n';
> }
> This code displays "partial". Clearly, regex_search is bombing out just as
> soon as it finds a match, partial or otherwise. But in this case, if it
> kept looking, it would find a full match.

Very stupid question, I guess, but I had to ask:

The regex "abc|b" means either "abc" or "b". How could "ab" provide a full
match if it kept looking ... ?

Rob.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk