mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 22:02:08 +02:00
Fix for grep and egrep syntax types, plus tests.
[SVN r36470]
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Often there is more that one way of matching a regular expression at a
|
||||
<P>Often there is more than one way of matching a regular expression at a
|
||||
particular location, for POSIX basic and extended regular expressions, the
|
||||
"best" match is determined as follows:</P>
|
||||
<OL>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Often there is more that one way of matching a regular expression at a
|
||||
<P>Often there is more than one way of matching a regular expression at a
|
||||
particular location, for POSIX basic and extended regular expressions, the
|
||||
"best" match is determined as follows:</P>
|
||||
<OL>
|
||||
|
@ -222,6 +222,11 @@ bool basic_regex_parser<charT, traits>::parse_basic()
|
||||
}
|
||||
case regex_constants::syntax_open_set:
|
||||
return parse_set();
|
||||
case regex_constants::syntax_newline:
|
||||
if(this->flags() & regbase::newline_alt)
|
||||
return parse_alt();
|
||||
else
|
||||
return parse_literal();
|
||||
default:
|
||||
return parse_literal();
|
||||
}
|
||||
@ -286,6 +291,11 @@ bool basic_regex_parser<charT, traits>::parse_extended()
|
||||
return parse_alt();
|
||||
case regex_constants::syntax_open_set:
|
||||
return parse_set();
|
||||
case regex_constants::syntax_newline:
|
||||
if(this->flags() & regbase::newline_alt)
|
||||
return parse_alt();
|
||||
else
|
||||
return parse_literal();
|
||||
case regex_constants::syntax_hash:
|
||||
//
|
||||
// If we have a mod_x flag set, then skip until
|
||||
|
@ -42,5 +42,9 @@ void test_alt()
|
||||
TEST_REGEX_SEARCH("a|", basic|bk_vbar, "a|", match_default, make_array(0, 2, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\\|b", basic|bk_vbar, "a", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\\|b", basic|bk_vbar, "b", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", grep, "b", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", grep, "a", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", egrep, "b", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", egrep, "a", match_default, make_array(0, 1, -2, -2));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user