forked from boostorg/regex
Merge regex changes from Trunk.
[SVN r76192]
This commit is contained in:
@ -34,9 +34,10 @@
|
||||
how captures and marked sub-expressions in Boost.Regex are represented and
|
||||
accessed.
|
||||
</p>
|
||||
<a name="boost_regex.captures.marked_sub_expressions"></a><h5>
|
||||
<a name="boost_regex.captures.marked_sub_expressions-heading"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.marked_sub_expressions">Marked sub-expressions</a>
|
||||
<h5>
|
||||
<a name="boost_regex.captures.h0"></a>
|
||||
<span><a name="boost_regex.captures.marked_sub_expressions"></a></span><a class="link" href="captures.html#boost_regex.captures.marked_sub_expressions">Marked
|
||||
sub-expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
Every time a Perl regular expression contains a parenthesis group <code class="computeroutput"><span class="special">()</span></code>, it spits out an extra field, known as a
|
||||
@ -217,9 +218,10 @@
|
||||
they can be compared to a string, added to a string, or streamed out to an
|
||||
output stream.
|
||||
</p>
|
||||
<a name="boost_regex.captures.unmatched_sub_expressions"></a><h5>
|
||||
<a name="boost_regex.captures.unmatched_sub_expressions-heading"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.unmatched_sub_expressions">Unmatched Sub-Expressions</a>
|
||||
<h5>
|
||||
<a name="boost_regex.captures.h1"></a>
|
||||
<span><a name="boost_regex.captures.unmatched_sub_expressions"></a></span><a class="link" href="captures.html#boost_regex.captures.unmatched_sub_expressions">Unmatched
|
||||
Sub-Expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
When a regular expression match is found there is no need for all of the marked
|
||||
@ -230,9 +232,10 @@
|
||||
can match either $1 or $2, but never both at the same time. In Boost.Regex
|
||||
you can determine which sub-expressions matched by accessing the <code class="computeroutput"><span class="identifier">sub_match</span><span class="special">::</span><span class="identifier">matched</span></code> data member.
|
||||
</p>
|
||||
<a name="boost_regex.captures.repeated_captures"></a><h5>
|
||||
<a name="boost_regex.captures.repeated_captures-heading"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.repeated_captures">Repeated Captures</a>
|
||||
<h5>
|
||||
<a name="boost_regex.captures.h2"></a>
|
||||
<span><a name="boost_regex.captures.repeated_captures"></a></span><a class="link" href="captures.html#boost_regex.captures.repeated_captures">Repeated
|
||||
Captures</a>
|
||||
</h5>
|
||||
<p>
|
||||
When a marked sub-expression is repeated, then the sub-expression gets "captured"
|
||||
@ -296,7 +299,7 @@
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(([[:lower:]]+)|([[:upper:]]+))+"</span><span class="special">,</span> <span class="string">"aBBcccDDDDDeeeeeeee"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(.*)bar|(.*)bah"</span><span class="special">,</span> <span class="string">"abcbar"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(.*)bar|(.*)bah"</span><span class="special">,</span> <span class="string">"abcbah"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"^(?:(\\w+)|(?>\\W+))*$"</span><span class="special">,</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"^(?:(\\w+)|(?>\\W+))*$"</span><span class="special">,</span>
|
||||
<span class="string">"now is the time for all good men to come to the aid of the party"</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
@ -347,7 +350,7 @@ Text: "now is the time for all good men to come to the aid of the party"
|
||||
$1 = "party"
|
||||
Captures:
|
||||
$0 = { "now is the time for all good men to come to the aid of the party" }
|
||||
$1 = { "now", "is", "the", "time", "for", "all", "good", "men", "to",
|
||||
$1 = { "now", "is", "the", "time", "for", "all", "good", "men", "to",
|
||||
"come", "to", "the", "aid", "of", "the", "party" }
|
||||
</pre>
|
||||
<p>
|
||||
|
Reference in New Issue
Block a user