mirror of
https://github.com/boostorg/regex.git
synced 2025-07-18 14:52:08 +02:00
Fixes for POSIX regexes not grepping correctly.
[SVN r22623]
This commit is contained in:
@ -208,7 +208,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_imp()
|
|||||||
search_base = position = m_result[0].second;
|
search_base = position = m_result[0].second;
|
||||||
// If last match was null and match_not_null was not set then increment
|
// If last match was null and match_not_null was not set then increment
|
||||||
// our start position, otherwise we go into an infinite loop:
|
// our start position, otherwise we go into an infinite loop:
|
||||||
if(((m_match_flags & match_not_null) == 0) && (m_presult->length() == 0))
|
if(((m_match_flags & match_not_null) == 0) && (m_result.length() == 0))
|
||||||
{
|
{
|
||||||
if(position == last)
|
if(position == last)
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,23 +55,22 @@ inline unsigned int regex_grep(Predicate foo,
|
|||||||
return count; // we've reached the end, don't try and find an extra null match.
|
return count; // we've reached the end, don't try and find an extra null match.
|
||||||
if(m.length() == 0)
|
if(m.length() == 0)
|
||||||
{
|
{
|
||||||
|
if(m[0].second == last)
|
||||||
|
return count;
|
||||||
// we found a NULL-match, now try to find
|
// we found a NULL-match, now try to find
|
||||||
// a non-NULL one at the same position:
|
// a non-NULL one at the same position:
|
||||||
BidiIterator last_end(m[0].second);
|
match_results<BidiIterator, match_allocator_type> m2(m);
|
||||||
if(last_end == last)
|
|
||||||
return count;
|
|
||||||
matcher.setf(match_not_null | match_continuous);
|
matcher.setf(match_not_null | match_continuous);
|
||||||
if(matcher.find())
|
if(matcher.find())
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
last_end = m[0].second;
|
|
||||||
if(0 == foo(m))
|
if(0 == foo(m))
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// reset match back to where it was:
|
// reset match back to where it was:
|
||||||
m.set_second(last_end);
|
m = m2;
|
||||||
}
|
}
|
||||||
matcher.unsetf((match_not_null | match_continuous) & ~flags);
|
matcher.unsetf((match_not_null | match_continuous) & ~flags);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user