mirror of
https://github.com/boostorg/regex.git
synced 2025-07-30 12:37:21 +02:00
Merge branch 'develop'
This commit is contained in:
@ -176,6 +176,13 @@
|
|||||||
<pre class="programlisting"><span class="identifier">a</span>
|
<pre class="programlisting"><span class="identifier">a</span>
|
||||||
<span class="identifier">aaaa</span>
|
<span class="identifier">aaaa</span>
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>
|
||||||
|
Note that the "{" and "}" characters will treated as
|
||||||
|
ordinary literals when used in a context that is not a repeat: this matches
|
||||||
|
Perl 5.x behavior. For example in the expressions "ab{1", "ab1}"
|
||||||
|
and "a{b}c" the curly brackets are all treated as literals and
|
||||||
|
<span class="emphasis"><em>no error will be raised</em></span>.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
It is an error to use a repeat operator, if the preceding construct can not
|
It is an error to use a repeat operator, if the preceding construct can not
|
||||||
be repeated, for example:
|
be repeated, for example:
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||||
<td align="left"><p><small>Last revised: May 23, 2014 at 12:15:55 GMT</small></p></td>
|
<td align="left"><p><small>Last revised: September 25, 2014 at 10:52:51 GMT</small></p></td>
|
||||||
<td align="right"><div class="copyright-footer"></div></td>
|
<td align="right"><div class="copyright-footer"></div></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -115,6 +115,11 @@ But neither of:
|
|||||||
a
|
a
|
||||||
aaaa
|
aaaa
|
||||||
|
|
||||||
|
Note that the "{" and "}" characters will treated as ordinary literals when used
|
||||||
|
in a context that is not a repeat: this matches Perl 5.x behavior. For example in
|
||||||
|
the expressions "ab{1", "ab1}" and "a{b}c" the curly brackets are all treated as
|
||||||
|
literals and ['no error will be raised].
|
||||||
|
|
||||||
It is an error to use a repeat operator, if the preceding construct can not
|
It is an error to use a repeat operator, if the preceding construct can not
|
||||||
be repeated, for example:
|
be repeated, for example:
|
||||||
|
|
||||||
|
@ -346,8 +346,13 @@ bool basic_regex_parser<charT, traits>::parse_extended()
|
|||||||
++m_position;
|
++m_position;
|
||||||
return parse_repeat_range(false);
|
return parse_repeat_range(false);
|
||||||
case regex_constants::syntax_close_brace:
|
case regex_constants::syntax_close_brace:
|
||||||
fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
|
if((this->flags() & regbase::no_perl_ex) == regbase::no_perl_ex)
|
||||||
return false;
|
{
|
||||||
|
fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
result = parse_literal();
|
||||||
|
break;
|
||||||
case regex_constants::syntax_or:
|
case regex_constants::syntax_or:
|
||||||
return parse_alt();
|
return parse_alt();
|
||||||
case regex_constants::syntax_open_set:
|
case regex_constants::syntax_open_set:
|
||||||
|
17
meta/libraries.json
Normal file
17
meta/libraries.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"key": "regex",
|
||||||
|
"name": "Regex",
|
||||||
|
"authors": [
|
||||||
|
"John Maddock"
|
||||||
|
],
|
||||||
|
"description": "Regular expression library.",
|
||||||
|
"std": [
|
||||||
|
"tr1"
|
||||||
|
],
|
||||||
|
"category": [
|
||||||
|
"String"
|
||||||
|
],
|
||||||
|
"maintainers": [
|
||||||
|
"John Maddock <john -at- johnmaddock.co.uk>"
|
||||||
|
]
|
||||||
|
}
|
@ -172,6 +172,10 @@ void test_simple_repeats()
|
|||||||
TEST_REGEX_SEARCH("^a{0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
|
TEST_REGEX_SEARCH("^a{0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
|
||||||
TEST_REGEX_SEARCH("^(?:a){0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
|
TEST_REGEX_SEARCH("^(?:a){0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
|
||||||
TEST_REGEX_SEARCH("^a(?:bc)?", perl, "abcbc", match_any|match_all, make_array(-2, -2));
|
TEST_REGEX_SEARCH("^a(?:bc)?", perl, "abcbc", match_any|match_all, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("a}", perl, "a}", match_default, make_array(0, 2, -2, -2));
|
||||||
|
TEST_REGEX_SEARCH("a{12b", perl, "a{12bc", match_default, make_array(0, 5, -2, -2));
|
||||||
|
TEST_INVALID_REGEX("a{b", extended);
|
||||||
|
TEST_INVALID_REGEX("a}b", extended);
|
||||||
test_simple_repeats2();
|
test_simple_repeats2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user