Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-04-07 06:15:10


>
> Is it just me or does regex_grep return overlapping matches when using the
match_posix flag? More specifically, grepping regex "a+" over text "-aaa-"
will find matches "aaa", "aa", and "a" at offsets 1, 2, and 3, respectively.
This does not happen using the match_perl flag. I've confirmed this on NT
and Linux platforms.
>
> The problem seems to be somewhere near perl_matcher::match_all_states(),
where the inner if(!(this->*proc)()) statement is entered multiple times and
thus indirectly sets (*m_presult)[0].second to an incorrect value, leading
to an incorrect restart point.
>
> I know that regex_grep is deprecated, but I still prefer it over the
iterator approach.
>
> Any ideas or comments?

Yep, there's a fix going into cvs now, the patch is:

Index: perl_matcher_common.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/regex/v4/perl_matcher_common.hpp,v
retrieving revision 1.18
diff -r1.18 perl_matcher_common.hpp
208c208
< search_base = position = (*m_presult)[0].second;

---
>       search_base = position = m_result[0].second;
Thanks for reporting that one,
John.

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