Perl/Python regular expressions vs. Boost.regex?

Rob Williscroft rtw at freenet.co.uk
Thu Oct 23 21:36:33 CEST 2008


 wrote in news:mailman.2906.1224773327.3487.python-list at python.org in
 comp.lang.python: 

> 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
> 

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

<quote>
Important 

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

So yes it does.

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list