regex lib: regex_grep w/ match_posix broken?

Hello, 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? Thanks, Ralph

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.
participants (2)
-
Benzinger, Ralph
-
John Maddock