Perl/Python regular expressions vs. Boost.regex?

S

skip

A colleague wrote a C++ library here at work which uses the Boost.regex
library. I quickly discovered an apparent problem with how it searches.
Unlike re.match the regex_match function in that library effectively anchors
the match at both the start and the end. Can other people confirm this?

Thx,

Skip Montanaro
 
S

skip

Rob> Quoting from : <url:http://www.boost.org/doc/libs/1_36_0/libs/regex/doc/html/boost_regex/ref/regex_match.html>

Rob> <quote>
Rob> Important

Rob> Note that the result is true only if the expression matches the
Rob> whole of the input sequence. If you want to search for an
Rob> expression somewhere within the sequence then use regex_search. If
Rob> you want to match a prefix of the character string then use
Rob> regex_search with the flag match_continuous set.

Rob> </quote>

Rob> So yes it does.

Thanks. I'll try and convince my colleague to use regex_search instead of
regex_match.

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top