diff --git a/doc/Attic/syntax_leftmost_longest.html b/doc/Attic/syntax_leftmost_longest.html index 4c8b25a8..6330fc5f 100644 --- a/doc/Attic/syntax_leftmost_longest.html +++ b/doc/Attic/syntax_leftmost_longest.html @@ -24,7 +24,7 @@


-

Often there is more that one way of matching a regular expression at a +

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:

    diff --git a/doc/syntax_leftmost_longest.html b/doc/syntax_leftmost_longest.html index 4c8b25a8..6330fc5f 100644 --- a/doc/syntax_leftmost_longest.html +++ b/doc/syntax_leftmost_longest.html @@ -24,7 +24,7 @@


    -

    Often there is more that one way of matching a regular expression at a +

    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:

      diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index ad77d054..08e705ad 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -222,6 +222,11 @@ bool basic_regex_parser::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::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 diff --git a/test/regress/test_alt.cpp b/test/regress/test_alt.cpp index 78676668..e55129a2 100644 --- a/test/regress/test_alt.cpp +++ b/test/regress/test_alt.cpp @@ -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)); }