Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-05-11 02:52:08


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. My understanding is that
full matches are always preferred to partial matches. I couldn't find
any discussion about this case in the regex docs or the std proposal.
Did I miss it? What's the intention here? Is the std proposal
underspecified?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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