mirror of
https://github.com/boostorg/regex.git
synced 2025-07-03 23:56:34 +02:00
Add support for named sub-expressions.
[SVN r52823]
This commit is contained in:
@ -17,13 +17,24 @@ should be sent to output as follows:
|
||||
[table
|
||||
[[Placeholder][Meaning]]
|
||||
[[$&][Outputs what matched the whole expression.]]
|
||||
[[$`][Outputs the text between the end of the last match found (or the
|
||||
[[$MATCH][As $&]]
|
||||
[[${^MATCH}][As $&]]
|
||||
[[$\`][Outputs the text between the end of the last match found (or the
|
||||
start of the text if no previous match was found), and the start
|
||||
of the current match.]]
|
||||
[[$PREMATCH][As $\`]]
|
||||
[[${^PREMATCH}][As $\`]]
|
||||
[[$'][Outputs all the text following the end of the current match.]]
|
||||
[[$POSTMATCH][As $']]
|
||||
[[${^POSTMATCH}][As $']]
|
||||
[[$+][Outputs what matched the last marked sub-expression in the regular expression.]]
|
||||
[[$LAST_PAREN_MATCH][As $+]]
|
||||
[[$LAST_SUBMATCH_RESULT][Outputs what matched the last sub-expression to be actually matched.]]
|
||||
[[$^N][As $LAST_SUBMATCH_RESULT]]
|
||||
[[$$][Outputs a literal '$']]
|
||||
[[$n][Outputs what matched the n'th sub-expression.]]
|
||||
[[${n}][Outputs what matched the n'th sub-expression.]]
|
||||
[[$+{NAME}][Outputs whatever matched the sub-expression named "NAME".]]
|
||||
]
|
||||
|
||||
Any $-placeholder sequence not listed above, results in '$' being treated
|
||||
|
@ -28,7 +28,7 @@
|
||||
Example Programs</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.background_information.examples.test_programs"></a><h5>
|
||||
<a name="id935382"></a>
|
||||
<a name="id934640"></a>
|
||||
<a class="link" href="examples.html#boost_regex.background_information.examples.test_programs">Test
|
||||
Programs</a>
|
||||
</h5>
|
||||
@ -107,7 +107,7 @@
|
||||
Files: <a href="../../../../test/captures/captures_test.cpp" target="_top">captures_test.cpp</a>.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.examples.example_programs"></a><h5>
|
||||
<a name="id935685"></a>
|
||||
<a name="id934943"></a>
|
||||
<a class="link" href="examples.html#boost_regex.background_information.examples.example_programs">Example
|
||||
programs</a>
|
||||
</h5>
|
||||
@ -133,7 +133,7 @@
|
||||
Files: <a href="../../../../example/timer/regex_timer.cpp" target="_top">regex_timer.cpp</a>.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.examples.code_snippets"></a><h5>
|
||||
<a name="id935744"></a>
|
||||
<a name="id935002"></a>
|
||||
<a class="link" href="examples.html#boost_regex.background_information.examples.code_snippets">Code
|
||||
snippets</a>
|
||||
</h5>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<a name="boost_regex.background_information.history"></a><a class="link" href="history.html" title="History"> History</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_38"></a><h5>
|
||||
<a name="id937370"></a>
|
||||
<a name="id936853"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_38">Boost
|
||||
1.38</a>
|
||||
</h5>
|
||||
@ -53,7 +53,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_34"></a><h5>
|
||||
<a name="id937448"></a>
|
||||
<a name="id936931"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_34">Boost
|
||||
1.34</a>
|
||||
</h5>
|
||||
@ -76,7 +76,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_33_1"></a><h5>
|
||||
<a name="id937479"></a>
|
||||
<a name="id936962"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_33_1">Boost
|
||||
1.33.1</a>
|
||||
</h5>
|
||||
@ -146,7 +146,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_33_0"></a><h5>
|
||||
<a name="id937558"></a>
|
||||
<a name="id937042"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_33_0">Boost
|
||||
1.33.0</a>
|
||||
</h5>
|
||||
@ -201,7 +201,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_32_1"></a><h5>
|
||||
<a name="id937617"></a>
|
||||
<a name="id937100"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_32_1">Boost
|
||||
1.32.1</a>
|
||||
</h5>
|
||||
@ -209,7 +209,7 @@
|
||||
Fixed bug in partial matches of bounded repeats of '.'.
|
||||
</li></ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_31_0"></a><h5>
|
||||
<a name="id937638"></a>
|
||||
<a name="id937121"></a>
|
||||
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_31_0">Boost
|
||||
1.31.0</a>
|
||||
</h5>
|
||||
|
@ -58,7 +58,7 @@
|
||||
There are three separate localization mechanisms supported by Boost.Regex:
|
||||
</p>
|
||||
<a name="boost_regex.background_information.locale.win32_localization_model_"></a><h5>
|
||||
<a name="id931072"></a>
|
||||
<a name="id931873"></a>
|
||||
<a class="link" href="locale.html#boost_regex.background_information.locale.win32_localization_model_">Win32
|
||||
localization model.</a>
|
||||
</h5>
|
||||
@ -90,7 +90,7 @@
|
||||
are treated as "unknown" graphic characters.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.locale.c_localization_model_"></a><h5>
|
||||
<a name="id931227"></a>
|
||||
<a name="id932028"></a>
|
||||
<a class="link" href="locale.html#boost_regex.background_information.locale.c_localization_model_">C
|
||||
localization model.</a>
|
||||
</h5>
|
||||
@ -114,7 +114,7 @@
|
||||
libraries including version 1 of this library.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.locale.c___localization_model_"></a><h5>
|
||||
<a name="id931295"></a>
|
||||
<a name="id932096"></a>
|
||||
<a class="link" href="locale.html#boost_regex.background_information.locale.c___localization_model_">C++
|
||||
localization model.</a>
|
||||
</h5>
|
||||
@ -151,7 +151,7 @@
|
||||
in your code. The best way to ensure this is to add the #define to <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">user</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.locale.providing_a_message_catalogue"></a><h5>
|
||||
<a name="id931597"></a>
|
||||
<a name="id932398"></a>
|
||||
<a class="link" href="locale.html#boost_regex.background_information.locale.providing_a_message_catalogue">Providing
|
||||
a message catalogue</a>
|
||||
</h5>
|
||||
|
@ -28,7 +28,7 @@
|
||||
Conformance</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.background_information.standards.c__"></a><h5>
|
||||
<a name="id936373"></a>
|
||||
<a name="id935994"></a>
|
||||
<a class="link" href="standards.html#boost_regex.background_information.standards.c__">C++</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -36,7 +36,7 @@
|
||||
Report on C++ Library Extensions</a>.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.ecmascript___javascript"></a><h5>
|
||||
<a name="id936395"></a>
|
||||
<a name="id936016"></a>
|
||||
<a class="link" href="standards.html#boost_regex.background_information.standards.ecmascript___javascript">ECMAScript
|
||||
/ JavaScript</a>
|
||||
</h5>
|
||||
@ -49,7 +49,7 @@
|
||||
rather than a Unicode escape sequence; use \x{DDDD} for Unicode escape sequences.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.perl"></a><h5>
|
||||
<a name="id936415"></a>
|
||||
<a name="id936036"></a>
|
||||
<a class="link" href="standards.html#boost_regex.background_information.standards.perl">Perl</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -62,7 +62,7 @@
|
||||
(??{code}) Not implementable in a compiled strongly typed language.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.posix"></a><h5>
|
||||
<a name="id936439"></a>
|
||||
<a name="id936060"></a>
|
||||
<a class="link" href="standards.html#boost_regex.background_information.standards.posix">POSIX</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -82,7 +82,7 @@
|
||||
a custom traits class.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.unicode"></a><h5>
|
||||
<a name="id936463"></a>
|
||||
<a name="id936084"></a>
|
||||
<a class="link" href="standards.html#boost_regex.background_information.standards.unicode">Unicode</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -35,7 +35,7 @@
|
||||
accessed.
|
||||
</p>
|
||||
<a name="boost_regex.captures.marked_sub_expressions"></a><h5>
|
||||
<a name="id781457"></a>
|
||||
<a name="id778863"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.marked_sub_expressions">Marked sub-expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -218,7 +218,7 @@
|
||||
output stream.
|
||||
</p>
|
||||
<a name="boost_regex.captures.unmatched_sub_expressions"></a><h5>
|
||||
<a name="id781913"></a>
|
||||
<a name="id779319"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.unmatched_sub_expressions">Unmatched Sub-Expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -231,7 +231,7 @@
|
||||
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="id781953"></a>
|
||||
<a name="id779359"></a>
|
||||
<a class="link" href="captures.html#boost_regex.captures.repeated_captures">Repeated Captures</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -32,7 +32,7 @@
|
||||
'$', '\', '(', ')', '?', and ':'.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.grouping"></a><h5>
|
||||
<a name="id802668"></a>
|
||||
<a name="id800525"></a>
|
||||
<a class="link" href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.grouping">Grouping</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -40,7 +40,7 @@
|
||||
you want a to output literal parenthesis.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.conditionals"></a><h5>
|
||||
<a name="id802685"></a>
|
||||
<a name="id800542"></a>
|
||||
<a class="link" href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.conditionals">Conditionals</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -66,7 +66,7 @@
|
||||
with "bar" otherwise.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.placeholder_sequences"></a><h5>
|
||||
<a name="id802722"></a>
|
||||
<a name="id800579"></a>
|
||||
<a class="link" href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.placeholder_sequences">Placeholder
|
||||
Sequences</a>
|
||||
</h5>
|
||||
@ -161,7 +161,7 @@
|
||||
as a literal.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.escape_sequences"></a><h5>
|
||||
<a name="id802862"></a>
|
||||
<a name="id800719"></a>
|
||||
<a class="link" href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.escape_sequences">Escape
|
||||
Sequences</a>
|
||||
</h5>
|
||||
|
@ -65,6 +65,30 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$MATCH
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $&
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
${^MATCH}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $&
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$`
|
||||
@ -79,6 +103,30 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$PREMATCH
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $`
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
${^PREMATCH}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $`
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$'
|
||||
@ -91,6 +139,79 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$POSTMATCH
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
${^POSTMATCH}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$+
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the last marked sub-expression in the regular
|
||||
expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$LAST_PAREN_MATCH
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $+
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$LAST_SUBMATCH_RESULT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the last sub-expression to be actually matched.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$^N
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As $LAST_SUBMATCH_RESULT
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$$
|
||||
@ -126,6 +247,18 @@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$+{NAME}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs whatever matched the sub-expression named "NAME".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
|
@ -49,7 +49,7 @@
|
||||
file before you can use it, instructions for specific platforms are as follows:
|
||||
</p>
|
||||
<a name="boost_regex.install.building_with_bjam"></a><h5>
|
||||
<a name="id778713"></a>
|
||||
<a name="id776123"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.building_with_bjam">Building with bjam</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -58,7 +58,7 @@
|
||||
started guide</a> for more information.
|
||||
</p>
|
||||
<a name="boost_regex.install.building_with_unicode_and_icu_support"></a><h5>
|
||||
<a name="id778737"></a>
|
||||
<a name="id776147"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.building_with_unicode_and_icu_support">Building
|
||||
With Unicode and ICU Support</a>
|
||||
</h5>
|
||||
@ -96,11 +96,11 @@
|
||||
ICU you are using is binary compatible with the toolset you use to build Boost.
|
||||
</p>
|
||||
<a name="boost_regex.install.building_via_makefiles"></a><h5>
|
||||
<a name="id778856"></a>
|
||||
<a name="id776266"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.building_via_makefiles">Building via makefiles</a>
|
||||
</h5>
|
||||
<a name="boost_regex.install.borland_c___builder_"></a><h6>
|
||||
<a name="id778869"></a>
|
||||
<a name="id776279"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.borland_c___builder_">Borland C++ Builder:</a>
|
||||
</h6>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
@ -166,7 +166,7 @@
|
||||
a lot in compile times!
|
||||
</p>
|
||||
<a name="boost_regex.install.microsoft_visual_c___6__7__7_1_and_8"></a><h5>
|
||||
<a name="id779108"></a>
|
||||
<a name="id776518"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.microsoft_visual_c___6__7__7_1_and_8">Microsoft
|
||||
Visual C++ 6, 7, 7.1 and 8</a>
|
||||
</h5>
|
||||
@ -253,7 +253,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.install.gcc_2_95_and_later_"></a><h6>
|
||||
<a name="id779307"></a>
|
||||
<a name="id776717"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.gcc_2_95_and_later_">GCC(2.95 and later)</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -302,7 +302,7 @@
|
||||
see the <a href="../../../../config/index.html" target="_top">config library documentation</a>.
|
||||
</p>
|
||||
<a name="boost_regex.install.sun_workshop_6_1"></a><h6>
|
||||
<a name="id779433"></a>
|
||||
<a name="id776843"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.sun_workshop_6_1">Sun Workshop 6.1</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -347,7 +347,7 @@
|
||||
will build v9 variants of the regex library named libboost_regex_v9.a etc.
|
||||
</p>
|
||||
<a name="boost_regex.install.makefiles_for_other_compilers"></a><h6>
|
||||
<a name="id779577"></a>
|
||||
<a name="id776987"></a>
|
||||
<a class="link" href="install.html#boost_regex.install.makefiles_for_other_compilers">Makefiles
|
||||
for Other compilers</a>
|
||||
</h6>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a name="boost_regex.ref.bad_expression"></a><a class="link" href="bad_expression.html" title="bad_expression"> bad_expression</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.ref.bad_expression.synopsis"></a><h5>
|
||||
<a name="id883611"></a>
|
||||
<a name="id883609"></a>
|
||||
<a class="link" href="bad_expression.html#boost_regex.ref.bad_expression.synopsis">Synopsis</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">pattern_except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
@ -54,7 +54,7 @@
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.bad_expression.description"></a><h5>
|
||||
<a name="id883972"></a>
|
||||
<a name="id883970"></a>
|
||||
<a class="link" href="bad_expression.html#boost_regex.ref.bad_expression.description">Description</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="identifier">regex_error</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">err</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">pos</span><span class="special">);</span>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a name="boost_regex.ref.basic_regex"></a><a class="link" href="basic_regex.html" title="basic_regex"> basic_regex</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.ref.basic_regex.synopsis"></a><h5>
|
||||
<a name="id803206"></a>
|
||||
<a name="id801063"></a>
|
||||
<a class="link" href="basic_regex.html#boost_regex.ref.basic_regex.synopsis">Synopsis</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
@ -244,7 +244,7 @@
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.basic_regex.description"></a><h5>
|
||||
<a name="id808818"></a>
|
||||
<a name="id805719"></a>
|
||||
<a class="link" href="basic_regex.html#boost_regex.ref.basic_regex.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -327,7 +327,7 @@
|
||||
<code class="computeroutput"><span class="identifier">basic_regex</span></code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id810182"></a><p class="title"><b>Table<EFBFBD>1.<2E>basic_regex default construction postconditions</b></p>
|
||||
<a name="id808722"></a><p class="title"><b>Table<EFBFBD>1.<2E>basic_regex default construction postconditions</b></p>
|
||||
<div class="table-contents"><table class="table" summary="basic_regex default construction postconditions">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -407,7 +407,7 @@
|
||||
flags</a> specified in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id812119"></a><p class="title"><b>Table<EFBFBD>2.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<a name="id809020"></a><p class="title"><b>Table<EFBFBD>2.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex construction">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -512,7 +512,7 @@
|
||||
specified in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id812531"></a><p class="title"><b>Table<EFBFBD>3.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<a name="id809433"></a><p class="title"><b>Table<EFBFBD>3.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex construction">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -616,7 +616,7 @@
|
||||
according the option flags specified in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id812936"></a><p class="title"><b>Table<EFBFBD>4.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<a name="id809837"></a><p class="title"><b>Table<EFBFBD>4.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex construction">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -727,7 +727,7 @@
|
||||
flags</a> specified in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id813412"></a><p class="title"><b>Table<EFBFBD>5.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<a name="id810313"></a><p class="title"><b>Table<EFBFBD>5.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex construction">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -829,7 +829,7 @@
|
||||
flags</a> specified in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id813771"></a><p class="title"><b>Table<EFBFBD>6.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<a name="id810676"></a><p class="title"><b>Table<EFBFBD>6.<2E>Postconditions for basic_regex construction</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex construction">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -1043,7 +1043,7 @@
|
||||
in <span class="emphasis"><em>f</em></span>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id815427"></a><p class="title"><b>Table<EFBFBD>7.<2E>Postconditions for basic_regex::assign</b></p>
|
||||
<a name="id812192"></a><p class="title"><b>Table<EFBFBD>7.<2E>Postconditions for basic_regex::assign</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Postconditions for basic_regex::assign">
|
||||
<colgroup>
|
||||
<col>
|
||||
|
@ -34,7 +34,7 @@
|
||||
Boost-specific enhanced interface.
|
||||
</p>
|
||||
<a name="boost_regex.ref.concepts.traits_concept.minimal_requirements_"></a><h5>
|
||||
<a name="id911309"></a>
|
||||
<a name="id911678"></a>
|
||||
<a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.minimal_requirements_">Minimal
|
||||
requirements.</a>
|
||||
</h5>
|
||||
@ -381,7 +381,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.ref.concepts.traits_concept.additional_optional_requirements"></a><h5>
|
||||
<a name="id911924"></a>
|
||||
<a name="id912293"></a>
|
||||
<a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.additional_optional_requirements">Additional
|
||||
Optional Requirements</a>
|
||||
</h5>
|
||||
|
@ -34,7 +34,7 @@
|
||||
previous version of Boost.Regex and will not be further updated:
|
||||
</p>
|
||||
<a name="boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format"></a><h5>
|
||||
<a name="id912446"></a>
|
||||
<a name="id912815"></a>
|
||||
<a class="link" href="regex_format.html#boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format">Algorithm
|
||||
regex_format</a>
|
||||
</h5>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a name="boost_regex.ref.error_type"></a><a class="link" href="error_type.html" title="error_type"> error_type</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.ref.error_type.synopsis"></a><h5>
|
||||
<a name="id889804"></a>
|
||||
<a name="id890553"></a>
|
||||
<a class="link" href="error_type.html#boost_regex.ref.error_type.synopsis">Synopsis</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -57,7 +57,7 @@
|
||||
</span><span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.error_type.description"></a><h5>
|
||||
<a name="id890220"></a>
|
||||
<a name="id890968"></a>
|
||||
<a class="link" href="error_type.html#boost_regex.ref.error_type.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -69,7 +69,7 @@
|
||||
</span><span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.match_flag_type.description"></a><h5>
|
||||
<a name="id889254"></a>
|
||||
<a name="id890002"></a>
|
||||
<a class="link" href="match_flag_type.html#boost_regex.ref.match_flag_type.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a name="boost_regex.ref.match_results"></a><a class="link" href="match_results.html" title="match_results"> match_results</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.ref.match_results.synopsis"></a><h5>
|
||||
<a name="id818644"></a>
|
||||
<a name="id816365"></a>
|
||||
<a class="link" href="match_results.html#boost_regex.ref.match_results.synopsis">Synopsis</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
@ -98,9 +98,33 @@
|
||||
<span class="keyword">bool</span> <a class="link" href="match_results.html#boost_regex.match_results.empty">empty</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="comment">// element access:
|
||||
</span> <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.prefix">prefix</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
|
||||
@ -142,7 +166,7 @@
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.match_results.description"></a><h5>
|
||||
<a name="id821784"></a>
|
||||
<a name="id821170"></a>
|
||||
<a class="link" href="match_results.html#boost_regex.ref.match_results.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -375,14 +399,39 @@
|
||||
<a name="boost_regex.match_results.length"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns the length of sub-expression
|
||||
<span class="emphasis"><em>sub</em></span>, that is to say: <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">sub</span><span class="special">].</span><span class="identifier">length</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The overloads that accept a string refer to a named sub-expression <span class="emphasis"><em>n</em></span>.
|
||||
In the event that there is no such named sub-expression then returns an empty
|
||||
string.
|
||||
</p>
|
||||
<p>
|
||||
The template overloads of this function, allow the string and/or character
|
||||
type to be different from the character type of the underlying sequence and/or
|
||||
regular expression: in this case the characters will be widened to the underlying
|
||||
character type of the original regular expression. A compiler error will
|
||||
occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used
|
||||
as an argument, even when the underlying character type of the expression
|
||||
being matched may be something more exotic such as a Unicode character type.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.position"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns the starting location of
|
||||
@ -391,17 +440,61 @@
|
||||
will return the location of the partial match even though <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
is false.
|
||||
</p>
|
||||
<p>
|
||||
The overloads that accept a string refer to a named sub-expression <span class="emphasis"><em>n</em></span>.
|
||||
In the event that there is no such named sub-expression then returns an empty
|
||||
string.
|
||||
</p>
|
||||
<p>
|
||||
The template overloads of this function, allow the string and/or character
|
||||
type to be different from the character type of the underlying sequence and/or
|
||||
regular expression: in this case the characters will be widened to the underlying
|
||||
character type of the original regular expression. A compiler error will
|
||||
occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used
|
||||
as an argument, even when the underlying character type of the expression
|
||||
being matched may be something more exotic such as a Unicode character type.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.str"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns sub-expression <span class="emphasis"><em>sub</em></span>
|
||||
as a string: <code class="computeroutput"><span class="identifier">string_type</span><span class="special">((*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">sub</span><span class="special">])</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The overloads that accept a string, return the string that matched the named
|
||||
sub-expression <span class="emphasis"><em>n</em></span>. In the event that there is no such
|
||||
named sub-expression then returns an empty string.
|
||||
</p>
|
||||
<p>
|
||||
The template overloads of this function, allow the string and/or character
|
||||
type to be different from the character type of the underlying sequence and/or
|
||||
regular expression: in this case the characters will be widened to the underlying
|
||||
character type of the original regular expression. A compiler error will
|
||||
occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used
|
||||
as an argument, even when the underlying character type of the expression
|
||||
being matched may be something more exotic such as a Unicode character type.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.subscript"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
@ -413,6 +506,22 @@
|
||||
then returns a <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
object whose matched member is false.
|
||||
</p>
|
||||
<p>
|
||||
The overloads that accept a string, return a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> object representing the
|
||||
character sequence that matched the named sub-expression <span class="emphasis"><em>n</em></span>.
|
||||
In the event that there is no such named sub-expression then returns a <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
object whose matched member is false.
|
||||
</p>
|
||||
<p>
|
||||
The template overloads of this function, allow the string and/or character
|
||||
type to be different from the character type of the underlying sequence and/or
|
||||
regular expression: in this case the characters will be widened to the underlying
|
||||
character type of the original regular expression. A compiler error will
|
||||
occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used
|
||||
as an argument, even when the underlying character type of the expression
|
||||
being matched may be something more exotic such as a Unicode character type.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.prefix"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">const_reference</span> <span class="identifier">prefix</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
|
@ -43,7 +43,7 @@
|
||||
on to the "real" algorithm.
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match"></a><h5>
|
||||
<a name="id892187"></a>
|
||||
<a name="id892919"></a>
|
||||
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match">u32regex_match</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -89,7 +89,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search"></a><h5>
|
||||
<a name="id892702"></a>
|
||||
<a name="id893433"></a>
|
||||
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search">u32regex_search</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -128,7 +128,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace"></a><h5>
|
||||
<a name="id893121"></a>
|
||||
<a name="id893852"></a>
|
||||
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace">u32regex_replace</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -28,7 +28,7 @@
|
||||
Unicode Aware Regex Iterators</a>
|
||||
</h5></div></div></div>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator"></a><h5>
|
||||
<a name="id893439"></a>
|
||||
<a name="id895846"></a>
|
||||
<a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator">u32regex_iterator</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -126,7 +126,7 @@
|
||||
Provided of course that the input is encoded as UTF-8.
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator"></a><h5>
|
||||
<a name="id895828"></a>
|
||||
<a name="id897114"></a>
|
||||
<a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator">u32regex_token_iterator</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -34,7 +34,7 @@
|
||||
here they are anyway:
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match"></a><h5>
|
||||
<a name="id900818"></a>
|
||||
<a name="id901958"></a>
|
||||
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match">regex_match</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -82,7 +82,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match__second_overload_"></a><h5>
|
||||
<a name="id901476"></a>
|
||||
<a name="id902615"></a>
|
||||
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match__second_overload_">regex_match
|
||||
(second overload)</a>
|
||||
</h5>
|
||||
@ -110,7 +110,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search"></a><h5>
|
||||
<a name="id901906"></a>
|
||||
<a name="id903046"></a>
|
||||
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search">regex_search</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -149,7 +149,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search__second_overload_"></a><h5>
|
||||
<a name="id902442"></a>
|
||||
<a name="id905658"></a>
|
||||
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search__second_overload_">regex_search
|
||||
(second overload)</a>
|
||||
</h5>
|
||||
@ -164,7 +164,7 @@
|
||||
<span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">f</span><span class="special">);</span></code>
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_replace"></a><h5>
|
||||
<a name="id905547"></a>
|
||||
<a name="id905949"></a>
|
||||
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_replace">regex_replace</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -32,7 +32,7 @@
|
||||
an MFC/ATL string to a <a class="link" href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a class="link" href="../../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a>:
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper"></a><h5>
|
||||
<a name="id906317"></a>
|
||||
<a name="id906719"></a>
|
||||
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper">regex_iterator
|
||||
creation helper</a>
|
||||
</h5>
|
||||
@ -68,7 +68,7 @@
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers"></a><h5>
|
||||
<a name="id906865"></a>
|
||||
<a name="id907267"></a>
|
||||
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers">regex_token_iterator
|
||||
creation helpers</a>
|
||||
</h5>
|
||||
|
@ -165,7 +165,7 @@
|
||||
<a name="regcomp"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regcomp"></a><h5>
|
||||
<a name="id909004"></a>
|
||||
<a name="id910499"></a>
|
||||
<a class="link" href="posix.html#boost_regex.ref.posix.regcomp">regcomp</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -379,7 +379,7 @@
|
||||
<a name="regerror"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regerror"></a><h5>
|
||||
<a name="id909510"></a>
|
||||
<a name="id911004"></a>
|
||||
<a class="link" href="posix.html#boost_regex.ref.posix.regerror">regerror</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -467,7 +467,7 @@
|
||||
<a name="regexec"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regexec"></a><h5>
|
||||
<a name="id909638"></a>
|
||||
<a name="id911133"></a>
|
||||
<a class="link" href="posix.html#boost_regex.ref.posix.regexec">regexec</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -537,7 +537,7 @@
|
||||
<a name="regfree"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regfree"></a><h5>
|
||||
<a name="id909750"></a>
|
||||
<a name="id911244"></a>
|
||||
<a class="link" href="posix.html#boost_regex.ref.posix.regfree">regfree</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -78,7 +78,7 @@
|
||||
<span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.regex_iterator.description"></a><h5>
|
||||
<a name="id867332"></a>
|
||||
<a name="id868627"></a>
|
||||
<a class="link" href="regex_iterator.html#boost_regex.ref.regex_iterator.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -436,7 +436,7 @@
|
||||
<span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_iterator.examples"></a><h5>
|
||||
<a name="id870714"></a>
|
||||
<a name="id870980"></a>
|
||||
<a class="link" href="regex_iterator.html#boost_regex.ref.regex_iterator.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -80,7 +80,7 @@
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.regex_match.description"></a><h5>
|
||||
<a name="id851340"></a>
|
||||
<a name="id852088"></a>
|
||||
<a class="link" href="regex_match.html#boost_regex.ref.regex_match.description">Description</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
@ -360,7 +360,7 @@
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns the result of <code class="computeroutput"><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_match.examples"></a><h5>
|
||||
<a name="id855348"></a>
|
||||
<a name="id854459"></a>
|
||||
<a class="link" href="regex_match.html#boost_regex.ref.regex_match.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -53,7 +53,7 @@
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.regex_replace.description"></a><h5>
|
||||
<a name="id861814"></a>
|
||||
<a name="id860924"></a>
|
||||
<a class="link" href="regex_replace.html#boost_regex.ref.regex_replace.description">Description</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
|
||||
@ -163,7 +163,7 @@
|
||||
and then returns <code class="computeroutput"><span class="identifier">result</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_replace.examples"></a><h5>
|
||||
<a name="id863066"></a>
|
||||
<a name="id864361"></a>
|
||||
<a class="link" href="regex_replace.html#boost_regex.ref.regex_replace.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -73,7 +73,7 @@
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.regex_search.description"></a><h5>
|
||||
<a name="id856972"></a>
|
||||
<a name="id857175"></a>
|
||||
<a class="link" href="regex_search.html#boost_regex.ref.regex_search.description">Description</a>
|
||||
</h5>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
@ -355,7 +355,7 @@
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns the result of <code class="computeroutput"><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_search.examples"></a><h5>
|
||||
<a name="id860498"></a>
|
||||
<a name="id859608"></a>
|
||||
<a class="link" href="regex_search.html#boost_regex.ref.regex_search.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -136,7 +136,7 @@
|
||||
<span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.regex_token_iterator.description"></a><h5>
|
||||
<a name="id876064"></a>
|
||||
<a name="id876881"></a>
|
||||
<a class="link" href="regex_token_iterator.html#boost_regex.ref.regex_token_iterator.description">Description</a>
|
||||
</h5>
|
||||
<a name="boost_regex.regex_token_iterator.construct1"></a><p>
|
||||
@ -383,7 +383,7 @@
|
||||
<span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_token_iterator.examples"></a><h5>
|
||||
<a name="id881603"></a>
|
||||
<a name="id881600"></a>
|
||||
<a class="link" href="regex_token_iterator.html#boost_regex.ref.regex_token_iterator.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -46,7 +46,7 @@
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.regex_traits.description"></a><h5>
|
||||
<a name="id890760"></a>
|
||||
<a name="id891508"></a>
|
||||
<a class="link" href="regex_traits.html#boost_regex.ref.regex_traits.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
|
@ -329,11 +329,11 @@
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.sub_match.description"></a><h5>
|
||||
<a name="id835742"></a>
|
||||
<a name="id836968"></a>
|
||||
<a class="link" href="sub_match.html#boost_regex.ref.sub_match.description">Description</a>
|
||||
</h5>
|
||||
<a name="boost_regex.ref.sub_match.members"></a><h6>
|
||||
<a name="id835755"></a>
|
||||
<a name="id836982"></a>
|
||||
<a class="link" href="sub_match.html#boost_regex.ref.sub_match.members">Members</a>
|
||||
</h6>
|
||||
<a name="boost_regex.sub_match.value_type"></a><p>
|
||||
@ -473,7 +473,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.ref.sub_match.sub_match_non_member_operators"></a><h6>
|
||||
<a name="id836855"></a>
|
||||
<a name="id838082"></a>
|
||||
<a class="link" href="sub_match.html#boost_regex.ref.sub_match.sub_match_non_member_operators">sub_match
|
||||
non-member operators</a>
|
||||
</h6>
|
||||
@ -1008,7 +1008,7 @@
|
||||
<span class="special">+</span> <span class="identifier">m2</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.sub_match.stream_inserter"></a><h6>
|
||||
<a name="id849395"></a>
|
||||
<a name="id848983"></a>
|
||||
<a class="link" href="sub_match.html#boost_regex.ref.sub_match.stream_inserter">Stream inserter</a>
|
||||
</h6>
|
||||
<a name="boost_regex.sub_match.op_stream"></a><p>
|
||||
|
@ -28,7 +28,7 @@
|
||||
Expression Syntax</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.syntax.basic_extended.synopsis"></a><h4>
|
||||
<a name="id791861"></a>
|
||||
<a name="id789119"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.synopsis">Synopsis</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -46,7 +46,7 @@
|
||||
<a name="boost_regex.posix_extended_syntax"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.posix_extended_syntax"></a><h4>
|
||||
<a name="id792040"></a>
|
||||
<a name="id789298"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.posix_extended_syntax">POSIX
|
||||
Extended Syntax</a>
|
||||
</h4>
|
||||
@ -56,7 +56,7 @@
|
||||
</p>
|
||||
<pre class="programlisting">.[{()\*+?|^$</pre>
|
||||
<a name="boost_regex.syntax.basic_extended.wildcard_"></a><h5>
|
||||
<a name="id792062"></a>
|
||||
<a name="id789319"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.wildcard_">Wildcard:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -74,7 +74,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.syntax.basic_extended.anchors_"></a><h5>
|
||||
<a name="id792106"></a>
|
||||
<a name="id789364"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.anchors_">Anchors:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -86,7 +86,7 @@
|
||||
of an expression, or the last character of a sub-expression.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.marked_sub_expressions_"></a><h5>
|
||||
<a name="id792129"></a>
|
||||
<a name="id789386"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.marked_sub_expressions_">Marked
|
||||
sub-expressions:</a>
|
||||
</h5>
|
||||
@ -98,7 +98,7 @@
|
||||
to by a back-reference.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.repeats_"></a><h5>
|
||||
<a name="id792163"></a>
|
||||
<a name="id789420"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.repeats_">Repeats:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -184,7 +184,7 @@ cab
|
||||
operator to be applied to.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.back_references_"></a><h5>
|
||||
<a name="id792469"></a>
|
||||
<a name="id789726"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.back_references_">Back references:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -214,7 +214,7 @@ cab
|
||||
</p></td></tr>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended.alternation"></a><h5>
|
||||
<a name="id792532"></a>
|
||||
<a name="id789790"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.alternation">Alternation</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -227,7 +227,7 @@ cab
|
||||
will match either of "abd" or "abef".
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.character_sets_"></a><h5>
|
||||
<a name="id792599"></a>
|
||||
<a name="id789857"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.character_sets_">Character
|
||||
sets:</a>
|
||||
</h5>
|
||||
@ -240,7 +240,7 @@ cab
|
||||
A bracket expression may contain any combination of the following:
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.single_characters_"></a><h6>
|
||||
<a name="id792620"></a>
|
||||
<a name="id789877"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.single_characters_">Single
|
||||
characters:</a>
|
||||
</h6>
|
||||
@ -249,7 +249,7 @@ cab
|
||||
or 'c'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.character_ranges_"></a><h6>
|
||||
<a name="id792651"></a>
|
||||
<a name="id789908"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.character_ranges_">Character
|
||||
ranges:</a>
|
||||
</h6>
|
||||
@ -265,7 +265,7 @@ cab
|
||||
the code points of the characters only.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.negation_"></a><h6>
|
||||
<a name="id792712"></a>
|
||||
<a name="id789970"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.negation_">Negation:</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -274,7 +274,7 @@ cab
|
||||
range <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.character_classes_"></a><h6>
|
||||
<a name="id792766"></a>
|
||||
<a name="id790024"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.character_classes_">Character
|
||||
classes:</a>
|
||||
</h6>
|
||||
@ -284,7 +284,7 @@ cab
|
||||
<a class="link" href="character_classes.html" title="Character Class Names">character class names</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.collating_elements_"></a><h6>
|
||||
<a name="id792818"></a>
|
||||
<a name="id790075"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.collating_elements_">Collating
|
||||
Elements:</a>
|
||||
</h6>
|
||||
@ -312,7 +312,7 @@ cab
|
||||
matches a NUL character.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.equivalence_classes_"></a><h6>
|
||||
<a name="id792920"></a>
|
||||
<a name="id790177"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.equivalence_classes_">Equivalence
|
||||
classes:</a>
|
||||
</h6>
|
||||
@ -329,7 +329,7 @@ cab
|
||||
or even all locales on one platform.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.combinations_"></a><h6>
|
||||
<a name="id792977"></a>
|
||||
<a name="id790235"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.combinations_">Combinations:</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -337,7 +337,7 @@ cab
|
||||
<code class="computeroutput"><span class="special">[[:</span><span class="identifier">digit</span><span class="special">:]</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">[.</span><span class="identifier">NUL</span><span class="special">.]]</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.escapes"></a><h5>
|
||||
<a name="id793030"></a>
|
||||
<a name="id790288"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.escapes">Escapes</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -363,7 +363,7 @@ cab
|
||||
extensions are also supported by Boost.Regex:
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.escapes_matching_a_specific_character"></a><h6>
|
||||
<a name="id793073"></a>
|
||||
<a name="id790331"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.escapes_matching_a_specific_character">Escapes
|
||||
matching a specific character</a>
|
||||
</h6>
|
||||
@ -552,7 +552,7 @@ cab
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended._quot_single_character_quot__character_classes_"></a><h6>
|
||||
<a name="id793364"></a>
|
||||
<a name="id790963"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended._quot_single_character_quot__character_classes_">"Single
|
||||
character" character classes:</a>
|
||||
</h6>
|
||||
@ -706,7 +706,7 @@ cab
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended.character_properties"></a><h6>
|
||||
<a name="id793921"></a>
|
||||
<a name="id791451"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.character_properties">Character
|
||||
Properties</a>
|
||||
</h6>
|
||||
@ -813,7 +813,7 @@ cab
|
||||
matches any "digit" character, as does <code class="computeroutput"><span class="special">\</span><span class="identifier">p</span><span class="special">{</span><span class="identifier">digit</span><span class="special">}</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.word_boundaries"></a><h6>
|
||||
<a name="id794228"></a>
|
||||
<a name="id791759"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.word_boundaries">Word Boundaries</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -888,7 +888,7 @@ cab
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended.buffer_boundaries"></a><h6>
|
||||
<a name="id794384"></a>
|
||||
<a name="id791915"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.buffer_boundaries">Buffer
|
||||
boundaries</a>
|
||||
</h6>
|
||||
@ -979,7 +979,7 @@ cab
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended.continuation_escape"></a><h6>
|
||||
<a name="id794569"></a>
|
||||
<a name="id792099"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.continuation_escape">Continuation
|
||||
Escape</a>
|
||||
</h6>
|
||||
@ -991,7 +991,7 @@ cab
|
||||
match to start where the last one ended.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.quoting_escape"></a><h6>
|
||||
<a name="id794597"></a>
|
||||
<a name="id792127"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.quoting_escape">Quoting
|
||||
escape</a>
|
||||
</h6>
|
||||
@ -1005,7 +1005,7 @@ cab
|
||||
<span class="special">\*+</span><span class="identifier">aaa</span>
|
||||
</pre>
|
||||
<a name="boost_regex.syntax.basic_extended.unicode_escapes"></a><h6>
|
||||
<a name="id794677"></a>
|
||||
<a name="id792207"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.unicode_escapes">Unicode
|
||||
escapes</a>
|
||||
</h6>
|
||||
@ -1056,7 +1056,7 @@ cab
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.basic_extended.any_other_escape"></a><h6>
|
||||
<a name="id794779"></a>
|
||||
<a name="id792309"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.any_other_escape">Any other
|
||||
escape</a>
|
||||
</h6>
|
||||
@ -1065,7 +1065,7 @@ cab
|
||||
\@ matches a literal '@'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.operator_precedence"></a><h5>
|
||||
<a name="id794796"></a>
|
||||
<a name="id792326"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.operator_precedence">Operator
|
||||
precedence</a>
|
||||
</h5>
|
||||
@ -1101,7 +1101,7 @@ cab
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="boost_regex.syntax.basic_extended.what_gets_matched"></a><h5>
|
||||
<a name="id794929"></a>
|
||||
<a name="id792459"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.what_gets_matched">What
|
||||
Gets Matched</a>
|
||||
</h5>
|
||||
@ -1111,11 +1111,11 @@ cab
|
||||
rule</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.variations"></a><h4>
|
||||
<a name="id794951"></a>
|
||||
<a name="id792481"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.variations">Variations</a>
|
||||
</h4>
|
||||
<a name="boost_regex.syntax.basic_extended.egrep"></a><h5>
|
||||
<a name="id794964"></a>
|
||||
<a name="id792494"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.egrep">Egrep</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -1136,7 +1136,7 @@ cab
|
||||
used with the -E option.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.awk"></a><h5>
|
||||
<a name="id795066"></a>
|
||||
<a name="id792596"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.awk">awk</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -1150,7 +1150,7 @@ cab
|
||||
these by default anyway.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.options"></a><h4>
|
||||
<a name="id795091"></a>
|
||||
<a name="id792621"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.options">Options</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -1163,7 +1163,7 @@ cab
|
||||
modify how the case and locale sensitivity are to be applied.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_extended.references"></a><h4>
|
||||
<a name="id795169"></a>
|
||||
<a name="id792699"></a>
|
||||
<a class="link" href="basic_extended.html#boost_regex.syntax.basic_extended.references">References</a>
|
||||
</h4>
|
||||
<p>
|
||||
|
@ -28,7 +28,7 @@
|
||||
Expression Syntax</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.syntax.basic_syntax.synopsis"></a><h4>
|
||||
<a name="id795218"></a>
|
||||
<a name="id792749"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.synopsis">Synopsis</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -45,7 +45,7 @@
|
||||
<a name="boost_regex.posix_basic"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.posix_basic_syntax"></a><h4>
|
||||
<a name="id795414"></a>
|
||||
<a name="id792944"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.posix_basic_syntax">POSIX
|
||||
Basic Syntax</a>
|
||||
</h4>
|
||||
@ -55,7 +55,7 @@
|
||||
</p>
|
||||
<pre class="programlisting">.[\*^$</pre>
|
||||
<a name="boost_regex.syntax.basic_syntax.wildcard_"></a><h5>
|
||||
<a name="id795435"></a>
|
||||
<a name="id792966"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.wildcard_">Wildcard:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -73,7 +73,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.syntax.basic_syntax.anchors_"></a><h5>
|
||||
<a name="id795480"></a>
|
||||
<a name="id793010"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.anchors_">Anchors:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -85,7 +85,7 @@
|
||||
of an expression, or the last character of a sub-expression.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.marked_sub_expressions_"></a><h5>
|
||||
<a name="id795500"></a>
|
||||
<a name="id793031"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.marked_sub_expressions_">Marked
|
||||
sub-expressions:</a>
|
||||
</h5>
|
||||
@ -97,7 +97,7 @@
|
||||
by a back-reference.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.repeats_"></a><h5>
|
||||
<a name="id795531"></a>
|
||||
<a name="id793062"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.repeats_">Repeats:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -155,7 +155,7 @@ aaaa
|
||||
to.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.back_references_"></a><h5>
|
||||
<a name="id795696"></a>
|
||||
<a name="id793982"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.back_references_">Back references:</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -173,7 +173,7 @@ aaaa
|
||||
</p>
|
||||
<pre class="programlisting">aaabba</pre>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_sets_"></a><h5>
|
||||
<a name="id796514"></a>
|
||||
<a name="id794031"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_sets_">Character
|
||||
sets:</a>
|
||||
</h5>
|
||||
@ -186,7 +186,7 @@ aaaa
|
||||
A bracket expression may contain any combination of the following:
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.single_characters_"></a><h6>
|
||||
<a name="id796534"></a>
|
||||
<a name="id794051"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.single_characters_">Single
|
||||
characters:</a>
|
||||
</h6>
|
||||
@ -195,7 +195,7 @@ aaaa
|
||||
or 'c'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_ranges_"></a><h6>
|
||||
<a name="id796565"></a>
|
||||
<a name="id794082"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_ranges_">Character
|
||||
ranges:</a>
|
||||
</h6>
|
||||
@ -211,7 +211,7 @@ aaaa
|
||||
of the characters only.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.negation_"></a><h6>
|
||||
<a name="id796622"></a>
|
||||
<a name="id794139"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.negation_">Negation:</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -220,7 +220,7 @@ aaaa
|
||||
range a-c.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_classes_"></a><h6>
|
||||
<a name="id796660"></a>
|
||||
<a name="id794177"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_classes_">Character
|
||||
classes:</a>
|
||||
</h6>
|
||||
@ -230,7 +230,7 @@ aaaa
|
||||
<a class="link" href="character_classes.html" title="Character Class Names">character class names</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.collating_elements_"></a><h6>
|
||||
<a name="id796712"></a>
|
||||
<a name="id794229"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.collating_elements_">Collating
|
||||
Elements:</a>
|
||||
</h6>
|
||||
@ -259,7 +259,7 @@ aaaa
|
||||
element names</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.equivalence_classes_"></a><h6>
|
||||
<a name="id796803"></a>
|
||||
<a name="id794320"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.equivalence_classes_">Equivalence
|
||||
classes:</a>
|
||||
</h6>
|
||||
@ -276,7 +276,7 @@ aaaa
|
||||
or even all locales on one platform.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.combinations_"></a><h6>
|
||||
<a name="id796860"></a>
|
||||
<a name="id794378"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.combinations_">Combinations:</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -284,7 +284,7 @@ aaaa
|
||||
<code class="computeroutput"><span class="special">[[:</span><span class="identifier">digit</span><span class="special">:]</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">[.</span><span class="identifier">NUL</span><span class="special">.]].</span></code>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.escapes"></a><h5>
|
||||
<a name="id796913"></a>
|
||||
<a name="id794430"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.escapes">Escapes</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -299,7 +299,7 @@ aaaa
|
||||
will match either a literal '\' or a '^'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.what_gets_matched"></a><h4>
|
||||
<a name="id796947"></a>
|
||||
<a name="id794464"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.what_gets_matched">What Gets
|
||||
Matched</a>
|
||||
</h4>
|
||||
@ -309,13 +309,13 @@ aaaa
|
||||
rule</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.variations"></a><h4>
|
||||
<a name="id796968"></a>
|
||||
<a name="id794486"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.variations">Variations</a>
|
||||
</h4>
|
||||
<a name="boost_regex.grep_syntax"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.grep"></a><h5>
|
||||
<a name="id796989"></a>
|
||||
<a name="id794506"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.grep">Grep</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -333,7 +333,7 @@ aaaa
|
||||
As its name suggests, this behavior is consistent with the Unix utility grep.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.emacs"></a><h5>
|
||||
<a name="id797084"></a>
|
||||
<a name="id794601"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.emacs">emacs</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -613,7 +613,7 @@ aaaa
|
||||
leftmost-longest rule</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.options"></a><h4>
|
||||
<a name="id797501"></a>
|
||||
<a name="id795018"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.options">Options</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -627,7 +627,7 @@ aaaa
|
||||
options</a> modify how the case and locale sensitivity are to be applied.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.references"></a><h4>
|
||||
<a name="id797608"></a>
|
||||
<a name="id795125"></a>
|
||||
<a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.references">References</a>
|
||||
</h4>
|
||||
<p>
|
||||
|
@ -28,7 +28,7 @@
|
||||
Syntax</a>
|
||||
</h3></div></div></div>
|
||||
<a name="boost_regex.syntax.perl_syntax.synopsis"></a><h4>
|
||||
<a name="id786230"></a>
|
||||
<a name="id783363"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.synopsis">Synopsis</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -43,7 +43,7 @@
|
||||
</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e2</span><span class="special">(</span><span class="identifier">my_expression</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">perl</span><span class="special">|</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">icase</span><span class="special">);</span>
|
||||
</pre>
|
||||
<a name="boost_regex.syntax.perl_syntax.perl_regular_expression_syntax"></a><h4>
|
||||
<a name="id786378"></a>
|
||||
<a name="id783510"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.perl_regular_expression_syntax">Perl
|
||||
Regular Expression Syntax</a>
|
||||
</h4>
|
||||
@ -53,7 +53,7 @@
|
||||
</p>
|
||||
<pre class="programlisting">.[{()\*+?|^$</pre>
|
||||
<a name="boost_regex.syntax.perl_syntax.wildcard"></a><h5>
|
||||
<a name="id786402"></a>
|
||||
<a name="id783534"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.wildcard">Wildcard</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -73,7 +73,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.syntax.perl_syntax.anchors"></a><h5>
|
||||
<a name="id786448"></a>
|
||||
<a name="id783581"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.anchors">Anchors</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -83,7 +83,7 @@
|
||||
A '$' character shall match the end of a line.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.marked_sub_expressions"></a><h5>
|
||||
<a name="id786470"></a>
|
||||
<a name="id783603"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.marked_sub_expressions">Marked
|
||||
sub-expressions</a>
|
||||
</h5>
|
||||
@ -94,7 +94,7 @@
|
||||
can also repeated, or referred to by a back-reference.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.non_marking_grouping"></a><h5>
|
||||
<a name="id786496"></a>
|
||||
<a name="id783629"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_marking_grouping">Non-marking
|
||||
grouping</a>
|
||||
</h5>
|
||||
@ -107,7 +107,7 @@
|
||||
without splitting out any separate sub-expressions.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.repeats"></a><h5>
|
||||
<a name="id786532"></a>
|
||||
<a name="id783665"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.repeats">Repeats</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -188,7 +188,7 @@
|
||||
to be applied to.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.non_greedy_repeats"></a><h5>
|
||||
<a name="id786769"></a>
|
||||
<a name="id783901"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_greedy_repeats">Non greedy
|
||||
repeats</a>
|
||||
</h5>
|
||||
@ -218,7 +218,7 @@
|
||||
while consuming as little input as possible.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.pocessive_repeats"></a><h5>
|
||||
<a name="id786828"></a>
|
||||
<a name="id783960"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.pocessive_repeats">Pocessive
|
||||
repeats</a>
|
||||
</h5>
|
||||
@ -250,7 +250,7 @@
|
||||
while giving nothing back.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.back_references"></a><h5>
|
||||
<a name="id786886"></a>
|
||||
<a name="id784019"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.back_references">Back references</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -340,10 +340,27 @@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">\g{one}</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Match whatever matched the sub-expression named "one"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Finally the \k escape can be used to refer to named subexpressions, for example
|
||||
<code class="literal">\k<two></code> will match whatever matched the subexpression
|
||||
named "two".
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.alternation"></a><h5>
|
||||
<a name="id787076"></a>
|
||||
<a name="id784239"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.alternation">Alternation</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -370,7 +387,7 @@
|
||||
<code class="literal">(?:abc)??</code> has exactly the same effect.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.character_sets"></a><h5>
|
||||
<a name="id787144"></a>
|
||||
<a name="id784307"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_sets">Character sets</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -382,7 +399,7 @@
|
||||
A bracket expression may contain any combination of the following:
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.single_characters"></a><h6>
|
||||
<a name="id787176"></a>
|
||||
<a name="id784612"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.single_characters">Single characters</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -390,7 +407,7 @@
|
||||
'b', or 'c'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.character_ranges"></a><h6>
|
||||
<a name="id787607"></a>
|
||||
<a name="id784633"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_ranges">Character
|
||||
ranges</a>
|
||||
</h6>
|
||||
@ -404,7 +421,7 @@
|
||||
sensitive.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.negation"></a><h6>
|
||||
<a name="id787640"></a>
|
||||
<a name="id784666"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.negation">Negation</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -413,7 +430,7 @@
|
||||
matches any character that is not in the range <code class="literal">a-c</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.character_classes"></a><h6>
|
||||
<a name="id787667"></a>
|
||||
<a name="id784693"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_classes">Character
|
||||
classes</a>
|
||||
</h6>
|
||||
@ -424,7 +441,7 @@
|
||||
class names</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.collating_elements"></a><h6>
|
||||
<a name="id787700"></a>
|
||||
<a name="id784726"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.collating_elements">Collating
|
||||
Elements</a>
|
||||
</h6>
|
||||
@ -446,7 +463,7 @@
|
||||
matches a <code class="literal">\0</code> character.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.equivalence_classes"></a><h6>
|
||||
<a name="id787762"></a>
|
||||
<a name="id784788"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.equivalence_classes">Equivalence
|
||||
classes</a>
|
||||
</h6>
|
||||
@ -463,7 +480,7 @@
|
||||
or even all locales on one platform.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.escaped_characters"></a><h6>
|
||||
<a name="id787810"></a>
|
||||
<a name="id784836"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.escaped_characters">Escaped
|
||||
Characters</a>
|
||||
</h6>
|
||||
@ -475,7 +492,7 @@
|
||||
is <span class="emphasis"><em>not</em></span> a "word" character.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.combinations"></a><h6>
|
||||
<a name="id787879"></a>
|
||||
<a name="id784905"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.combinations">Combinations</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -483,7 +500,7 @@
|
||||
<code class="literal">[[:digit:]a-c[.NUL.]]</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.escapes"></a><h5>
|
||||
<a name="id787900"></a>
|
||||
<a name="id784926"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.escapes">Escapes</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -675,7 +692,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.perl_syntax._quot_single_character_quot__character_classes_"></a><h6>
|
||||
<a name="id788288"></a>
|
||||
<a name="id785314"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax._quot_single_character_quot__character_classes_">"Single
|
||||
character" character classes:</a>
|
||||
</h6>
|
||||
@ -877,7 +894,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.perl_syntax.character_properties"></a><h6>
|
||||
<a name="id788888"></a>
|
||||
<a name="id785914"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_properties">Character
|
||||
Properties</a>
|
||||
</h6>
|
||||
@ -985,7 +1002,7 @@
|
||||
as does <code class="literal">\p{digit}</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.word_boundaries"></a><h6>
|
||||
<a name="id789177"></a>
|
||||
<a name="id786203"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.word_boundaries">Word Boundaries</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1004,7 +1021,7 @@
|
||||
<code class="literal">\B</code> Matches only when not at a word boundary.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.buffer_boundaries"></a><h6>
|
||||
<a name="id789229"></a>
|
||||
<a name="id786255"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.buffer_boundaries">Buffer boundaries</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1029,7 +1046,7 @@
|
||||
to the regular expression <code class="literal">\n*\z</code>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.continuation_escape"></a><h6>
|
||||
<a name="id789269"></a>
|
||||
<a name="id786295"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.continuation_escape">Continuation
|
||||
Escape</a>
|
||||
</h6>
|
||||
@ -1041,7 +1058,7 @@
|
||||
one ended.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.quoting_escape"></a><h6>
|
||||
<a name="id789291"></a>
|
||||
<a name="id786317"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.quoting_escape">Quoting escape</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1054,7 +1071,7 @@
|
||||
<span class="special">\*+</span><span class="identifier">aaa</span>
|
||||
</pre>
|
||||
<a name="boost_regex.syntax.perl_syntax.unicode_escapes"></a><h6>
|
||||
<a name="id789338"></a>
|
||||
<a name="id786364"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.unicode_escapes">Unicode escapes</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1064,7 +1081,7 @@
|
||||
followed by a sequence of zero or more combining characters.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.matching_line_endings"></a><h6>
|
||||
<a name="id789364"></a>
|
||||
<a name="id786390"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.matching_line_endings">Matching
|
||||
Line Endings</a>
|
||||
</h6>
|
||||
@ -1073,7 +1090,7 @@
|
||||
sequence, specifically it is identical to the expression <code class="literal">(?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}])</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.keeping_back_some_text"></a><h6>
|
||||
<a name="id789391"></a>
|
||||
<a name="id786417"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.keeping_back_some_text">Keeping
|
||||
back some text</a>
|
||||
</h6>
|
||||
@ -1088,7 +1105,7 @@
|
||||
This can be used to simulate variable width lookbehind assertions.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.any_other_escape"></a><h6>
|
||||
<a name="id789421"></a>
|
||||
<a name="id786447"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.any_other_escape">Any other
|
||||
escape</a>
|
||||
</h6>
|
||||
@ -1097,7 +1114,7 @@
|
||||
\@ matches a literal '@'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.perl_extended_patterns"></a><h5>
|
||||
<a name="id789437"></a>
|
||||
<a name="id786463"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.perl_extended_patterns">Perl
|
||||
Extended Patterns</a>
|
||||
</h5>
|
||||
@ -1105,15 +1122,37 @@
|
||||
Perl-specific extensions to the regular expression syntax all start with
|
||||
<code class="literal">(?</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.named_subexpressions"></a><h6>
|
||||
<a name="id786485"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.named_subexpressions">Named
|
||||
Subexpressions</a>
|
||||
</h6>
|
||||
<p>
|
||||
You can create a named subexpression using:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="special">(?<</span><span class="identifier">NAME</span><span class="special">></span><span class="identifier">expression</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
Which can be then be refered to by the name <span class="emphasis"><em>NAME</em></span>. Alternatively
|
||||
you can delimit the name using 'NAME' as in:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="special">(?</span><span class="char">'NAME'</span><span class="identifier">expression</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
These named subexpressions can be refered to in a backreference using either
|
||||
<code class="literal">\g{NAME}</code> or <code class="literal">\k<NAME></code> and can
|
||||
also be refered to by name in a <a class="link" href="../format/perl_format.html" title="Perl Format String Syntax">Perl</a>
|
||||
format string for search and replace operations, or in the <a class="link" href="../ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> member functions.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.comments"></a><h6>
|
||||
<a name="id789459"></a>
|
||||
<a name="id786580"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.comments">Comments</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="literal">(?# ... )</code> is treated as a comment, it's contents are ignored.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.modifiers"></a><h6>
|
||||
<a name="id789482"></a>
|
||||
<a name="id786603"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.modifiers">Modifiers</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1127,7 +1166,7 @@
|
||||
pattern only.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.non_marking_groups"></a><h6>
|
||||
<a name="id789517"></a>
|
||||
<a name="id786637"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_marking_groups">Non-marking
|
||||
groups</a>
|
||||
</h6>
|
||||
@ -1136,7 +1175,7 @@
|
||||
an additional sub-expression.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.lookahead"></a><h6>
|
||||
<a name="id789538"></a>
|
||||
<a name="id786659"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.lookahead">Lookahead</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1159,7 +1198,7 @@
|
||||
could be used to validate the password.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.lookbehind"></a><h6>
|
||||
<a name="id789613"></a>
|
||||
<a name="id786733"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.lookbehind">Lookbehind</a>
|
||||
</h6>
|
||||
<p>
|
||||
@ -1173,7 +1212,7 @@
|
||||
(pattern must be of fixed length).
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.independent_sub_expressions"></a><h6>
|
||||
<a name="id789645"></a>
|
||||
<a name="id786766"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.independent_sub_expressions">Independent
|
||||
sub-expressions</a>
|
||||
</h6>
|
||||
@ -1186,7 +1225,7 @@
|
||||
no match is found at all.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.conditional_expressions"></a><h6>
|
||||
<a name="id789676"></a>
|
||||
<a name="id788436"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.conditional_expressions">Conditional
|
||||
Expressions</a>
|
||||
</h6>
|
||||
@ -1205,7 +1244,7 @@
|
||||
sub-expression has been matched).
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.operator_precedence"></a><h5>
|
||||
<a name="id789731"></a>
|
||||
<a name="id788491"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.operator_precedence">Operator
|
||||
precedence</a>
|
||||
</h5>
|
||||
@ -1240,7 +1279,7 @@
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="boost_regex.syntax.perl_syntax.what_gets_matched"></a><h4>
|
||||
<a name="id791324"></a>
|
||||
<a name="id788581"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.what_gets_matched">What gets
|
||||
matched</a>
|
||||
</h4>
|
||||
@ -1415,7 +1454,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.syntax.perl_syntax.variations"></a><h4>
|
||||
<a name="id791681"></a>
|
||||
<a name="id788939"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.variations">Variations</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -1424,7 +1463,7 @@
|
||||
and <code class="literal">JScript</code></a> are all synonyms for <code class="literal">perl</code>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.options"></a><h4>
|
||||
<a name="id791728"></a>
|
||||
<a name="id788986"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.options">Options</a>
|
||||
</h4>
|
||||
<p>
|
||||
@ -1436,7 +1475,7 @@
|
||||
are to be applied.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.pattern_modifiers"></a><h4>
|
||||
<a name="id791776"></a>
|
||||
<a name="id789034"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.pattern_modifiers">Pattern
|
||||
Modifiers</a>
|
||||
</h4>
|
||||
@ -1448,7 +1487,7 @@
|
||||
and <code class="literal">no_mod_s</code></a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.perl_syntax.references"></a><h4>
|
||||
<a name="id791829"></a>
|
||||
<a name="id789086"></a>
|
||||
<a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.references">References</a>
|
||||
</h4>
|
||||
<p>
|
||||
|
@ -30,7 +30,7 @@
|
||||
There are two ways to use Boost.Regex with Unicode strings:
|
||||
</p>
|
||||
<a name="boost_regex.unicode.rely_on_wchar_t"></a><h5>
|
||||
<a name="id780741"></a>
|
||||
<a name="id778151"></a>
|
||||
<a class="link" href="unicode.html#boost_regex.unicode.rely_on_wchar_t">Rely on wchar_t</a>
|
||||
</h5>
|
||||
<p>
|
||||
@ -56,7 +56,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.unicode.use_a_unicode_aware_regular_expression_type_"></a><h5>
|
||||
<a name="id780858"></a>
|
||||
<a name="id778268"></a>
|
||||
<a class="link" href="unicode.html#boost_regex.unicode.use_a_unicode_aware_regular_expression_type_">Use
|
||||
a Unicode Aware Regular Expression Type.</a>
|
||||
</h5>
|
||||
|
@ -28,7 +28,7 @@
|
||||
</h3></div></div></div>
|
||||
<div><p class="copyright">Copyright <20> 1998 -2007 John Maddock</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id770426"></a><p>
|
||||
<a name="id767848"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@ -196,7 +196,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: April 25, 2009 at 17:20:04 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: May 06, 2009 at 16:25:16 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -71,9 +71,33 @@ Class template `match_results` is most commonly used as one of the typedefs
|
||||
bool ``[link boost_regex.match_results.empty empty]``() const;
|
||||
// element access:
|
||||
difference_type ``[link boost_regex.match_results.length length]``(int sub = 0) const;
|
||||
difference_type ``[link boost_regex.match_results.length length]``(const char_type* sub) const;
|
||||
template <class charT>
|
||||
difference_type ``[link boost_regex.match_results.length length]``(const charT* sub) const;
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type ``[link boost_regex.match_results.length length]``(const std::basic_string<charT, Traits, A>& sub) const;
|
||||
difference_type ``[link boost_regex.match_results.position position]``(unsigned int sub = 0) const;
|
||||
difference_type ``[link boost_regex.match_results.position position]``(const char_type* sub) const;
|
||||
template <class charT>
|
||||
difference_type ``[link boost_regex.match_results.position position]``(const charT* sub) const;
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type ``[link boost_regex.match_results.position position]``(const std::basic_string<charT, Traits, A>& sub) const;
|
||||
string_type ``[link boost_regex.match_results.str str]``(int sub = 0) const;
|
||||
string_type ``[link boost_regex.match_results.str str]``(const char_type* sub)const;
|
||||
template <class Traits, class A>
|
||||
string_type ``[link boost_regex.match_results.str str]``(const std::basic_string<char_type, Traits, A>& sub)const;
|
||||
template <class charT>
|
||||
string_type ``[link boost_regex.match_results.str str]``(const charT* sub)const;
|
||||
template <class charT, class Traits, class A>
|
||||
string_type ``[link boost_regex.match_results.str str]``(const std::basic_string<charT, Traits, A>& sub)const;
|
||||
const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(int n) const;
|
||||
const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const char_type* n) const;
|
||||
template <class Traits, class A>
|
||||
const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const std::basic_string<char_type, Traits, A>& n) const;
|
||||
template <class charT>
|
||||
const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const charT* n) const;
|
||||
template <class charT, class Traits, class A>
|
||||
const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const std::basic_string<charT, Traits, A>& n) const;
|
||||
|
||||
const_reference ``[link boost_regex.match_results.prefix prefix]``() const;
|
||||
|
||||
@ -190,30 +214,86 @@ stored in *this.
|
||||
[#boost_regex.match_results.length]
|
||||
|
||||
difference_type length(int sub = 0)const;
|
||||
difference_type length(const char_type* sub)const;
|
||||
template <class charT>
|
||||
difference_type length(const charT* sub)const;
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type length(const std::basic_string<charT, Traits, A>&)const;
|
||||
|
||||
[*Effects]: Returns the length of sub-expression /sub/, that is to say:
|
||||
`(*this)[sub].length()`.
|
||||
|
||||
The overloads that accept a string refer to a named sub-expression /n/.
|
||||
In the event that there is no such named sub-expression then returns an empty string.
|
||||
|
||||
The template overloads of this function, allow the string and\/or character type
|
||||
to be different from the character type of the underlying sequence and\/or regular expression:
|
||||
in this case the characters will be widened to the underlying character type of the original regular expression.
|
||||
A compiler error will occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used as an argument, even when
|
||||
the underlying character type of the expression being matched may be something more exotic such as a
|
||||
Unicode character type.
|
||||
|
||||
[#boost_regex.match_results.position]
|
||||
|
||||
difference_type position(unsigned int sub = 0)const;
|
||||
difference_type position(const char_type* sub)const;
|
||||
template <class charT>
|
||||
difference_type position(const charT* sub)const;
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type position(const std::basic_string<charT, Traits, A>&)const;
|
||||
|
||||
[*Effects]: Returns the starting location of sub-expression /sub/, or -1 if /sub/ was
|
||||
not matched. Note that if this represents a partial match , then `position()`
|
||||
will return the location of the partial match even though `(*this)[0].matched` is false.
|
||||
|
||||
The overloads that accept a string refer to a named sub-expression /n/.
|
||||
In the event that there is no such named sub-expression then returns an empty string.
|
||||
|
||||
The template overloads of this function, allow the string and\/or character type
|
||||
to be different from the character type of the underlying sequence and\/or regular expression:
|
||||
in this case the characters will be widened to the underlying character type of the original regular expression.
|
||||
A compiler error will occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used as an argument, even when
|
||||
the underlying character type of the expression being matched may be something more exotic such as a
|
||||
Unicode character type.
|
||||
|
||||
|
||||
[#boost_regex.match_results.str]
|
||||
|
||||
string_type str(int sub = 0)const;
|
||||
string_type str(const char_type* sub)const;
|
||||
template <class Traits, class A>
|
||||
string_type str(const std::basic_string<char_type, Traits, A>& sub)const;
|
||||
template <class charT>
|
||||
string_type str(const charT* sub)const;
|
||||
template <class charT, class Traits, class A>
|
||||
string_type str(const std::basic_string<charT, Traits, A>& sub)const;
|
||||
|
||||
[*Effects]: Returns sub-expression /sub/ as a string: `string_type((*this)[sub])`.
|
||||
|
||||
The overloads that accept a string, return the string that matched the named sub-expression /n/.
|
||||
In the event that there is no such named sub-expression then returns an empty string.
|
||||
|
||||
The template overloads of this function, allow the string and\/or character type
|
||||
to be different from the character type of the underlying sequence and\/or regular expression:
|
||||
in this case the characters will be widened to the underlying character type of the original regular expression.
|
||||
A compiler error will occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used as an argument, even when
|
||||
the underlying character type of the expression being matched may be something more exotic such as a
|
||||
Unicode character type.
|
||||
|
||||
|
||||
[#boost_regex.match_results.subscript]
|
||||
|
||||
const_reference operator[](int n) const;
|
||||
const_reference operator[](const char_type* n) const;
|
||||
template <class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<char_type, Traits, A>& n) const;
|
||||
template <class charT>
|
||||
const_reference operator[](const charT* n) const;
|
||||
template <class charT, class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<charT, Traits, A>& n) const;
|
||||
|
||||
[*Effects]: Returns a reference to the [sub_match] object representing the character
|
||||
sequence that matched marked sub-expression /n/. If `n == 0` then returns a
|
||||
@ -222,6 +302,19 @@ matched the whole regular expression. If /n/ is out of range, or if /n/ is an
|
||||
unmatched sub-expression, then returns a [sub_match] object whose matched
|
||||
member is false.
|
||||
|
||||
The overloads that accept a string, return a reference to the [sub_match]
|
||||
object representing the character sequence that matched the named sub-expression /n/.
|
||||
In the event that there is no such named sub-expression then returns a [sub_match] object whose matched
|
||||
member is false.
|
||||
|
||||
The template overloads of this function, allow the string and\/or character type
|
||||
to be different from the character type of the underlying sequence and\/or regular expression:
|
||||
in this case the characters will be widened to the underlying character type of the original regular expression.
|
||||
A compiler error will occur if the argument passes a wider character type than the underlying sequence.
|
||||
These overloads allow a normal narrow character C string literal to be used as an argument, even when
|
||||
the underlying character type of the expression being matched may be something more exotic such as a
|
||||
Unicode character type.
|
||||
|
||||
|
||||
[#boost_regex.match_results.prefix]
|
||||
|
||||
|
@ -185,8 +185,12 @@ You can also use the \g escape for the same function, for example:
|
||||
parsing of the expression in cases like =\g{1}2= or for indexes higher than 9 as in =\g{1234}=]]
|
||||
[[=\g-1=][Match whatever matched the last opened sub-expression]]
|
||||
[[=\g{-2}=][Match whatever matched the last but one opened sub-expression]]
|
||||
[[=\g{one}=][Match whatever matched the sub-expression named "one"]]
|
||||
]
|
||||
|
||||
Finally the \k escape can be used to refer to named subexpressions, for example [^\k<two>] will match
|
||||
whatever matched the subexpression named "two".
|
||||
|
||||
[h4 Alternation]
|
||||
|
||||
The =|= operator will match either of its arguments, so for example:
|
||||
@ -425,6 +429,21 @@ Any other escape sequence matches the character that is escaped, for example
|
||||
|
||||
Perl-specific extensions to the regular expression syntax all start with =(?=.
|
||||
|
||||
[h5 Named Subexpressions]
|
||||
|
||||
You can create a named subexpression using:
|
||||
|
||||
(?<NAME>expression)
|
||||
|
||||
Which can be then be refered to by the name /NAME/. Alternatively you can delimit the name
|
||||
using 'NAME' as in:
|
||||
|
||||
(?'NAME'expression)
|
||||
|
||||
These named subexpressions can be refered to in a backreference using either [^\g{NAME}] or [^\k<NAME>]
|
||||
and can also be refered to by name in a [perl_format] format string for search and replace operations, or in the
|
||||
[match_results] member functions.
|
||||
|
||||
[h5 Comments]
|
||||
|
||||
=(?# ... )= is treated as a comment, it's contents are ignored.
|
||||
|
@ -844,6 +844,42 @@ struct BoostRegexConcept
|
||||
m_string = m_char + m_sub;
|
||||
ignore_unused_variable_warning(m_string);
|
||||
|
||||
// Named sub-expressions:
|
||||
m_sub = m_cresults[&m_char];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[m_string];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[""];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[std::string("")];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_string = m_cresults.str(&m_char);
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str(m_string);
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str("");
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str(std::string(""));
|
||||
ignore_unused_variable_warning(m_string);
|
||||
|
||||
typename match_results_type::difference_type diff;
|
||||
diff = m_cresults.length(&m_char);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length(m_string);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length("");
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length(std::string(""));
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(&m_char);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(m_string);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position("");
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(std::string(""));
|
||||
ignore_unused_variable_warning(diff);
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_stream << m_sub;
|
||||
m_stream << m_cresults;
|
||||
|
@ -19,6 +19,8 @@
|
||||
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
|
||||
#define BOOST_REGEX_V4_BASIC_REGEX_HPP
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
@ -44,12 +46,123 @@ namespace re_detail{
|
||||
template <class charT, class traits>
|
||||
class basic_regex_parser;
|
||||
|
||||
template <class I>
|
||||
void bubble_down_one(I first, I last)
|
||||
{
|
||||
if(first != last)
|
||||
{
|
||||
I next = last - 1;
|
||||
while((next != first) && !(*(next-1) < *next))
|
||||
{
|
||||
(next-1)->swap(*next);
|
||||
--next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Class named_subexpressions
|
||||
// Contains information about named subexpressions within the regex.
|
||||
//
|
||||
template <class charT>
|
||||
class named_subexpressions_base
|
||||
{
|
||||
public:
|
||||
virtual int get_id(const charT* i, const charT* j) = 0;
|
||||
};
|
||||
|
||||
template <class charT>
|
||||
class named_subexpressions : public named_subexpressions_base<charT>
|
||||
{
|
||||
struct name
|
||||
{
|
||||
name(const charT* i, const charT* j, int idx)
|
||||
: n(i, j), index(idx) {}
|
||||
std::vector<charT> n;
|
||||
int index;
|
||||
bool operator < (const name& other)const
|
||||
{
|
||||
return std::lexicographical_compare(n.begin(), n.end(), other.n.begin(), other.n.end());
|
||||
}
|
||||
bool operator == (const name& other)const
|
||||
{
|
||||
return n == other.n;
|
||||
}
|
||||
void swap(name& other)
|
||||
{
|
||||
n.swap(other.n);
|
||||
std::swap(index, other.index);
|
||||
}
|
||||
};
|
||||
public:
|
||||
named_subexpressions(){}
|
||||
void set_name(const charT* i, const charT* j, int index)
|
||||
{
|
||||
m_sub_names.push_back(name(i, j, index));
|
||||
bubble_down_one(m_sub_names.begin(), m_sub_names.end());
|
||||
}
|
||||
int get_id(const charT* i, const charT* j)
|
||||
{
|
||||
name t(i, j, 0);
|
||||
typename std::vector<name>::const_iterator pos = lower_bound(m_sub_names.begin(), m_sub_names.end(), t);
|
||||
if((pos != m_sub_names.end()) && (*pos == t))
|
||||
{
|
||||
return pos->index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private:
|
||||
std::vector<name> m_sub_names;
|
||||
};
|
||||
|
||||
template <class charT, class Other>
|
||||
class named_subexpressions_converter : public named_subexpressions_base<charT>
|
||||
{
|
||||
boost::shared_ptr<named_subexpressions<Other> > m_converter;
|
||||
public:
|
||||
named_subexpressions_converter(boost::shared_ptr<named_subexpressions<Other> > s)
|
||||
: m_converter(s) {}
|
||||
virtual int get_id(const charT* i, const charT* j)
|
||||
{
|
||||
if(i == j)
|
||||
return -1;
|
||||
std::vector<Other> v;
|
||||
while(i != j)
|
||||
{
|
||||
v.push_back(*i);
|
||||
++i;
|
||||
}
|
||||
return m_converter->get_id(&v[0], &v[0] + v.size());
|
||||
}
|
||||
};
|
||||
|
||||
template <class To>
|
||||
inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp(
|
||||
boost::shared_ptr<named_subexpressions<To> > s,
|
||||
boost::integral_constant<bool,true> const&)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
template <class To, class From>
|
||||
inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp(
|
||||
boost::shared_ptr<named_subexpressions<From> > s,
|
||||
boost::integral_constant<bool,false> const&)
|
||||
{
|
||||
return boost::shared_ptr<named_subexpressions_converter<To, From> >(new named_subexpressions_converter<To, From>(s));
|
||||
}
|
||||
template <class To, class From>
|
||||
inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs(
|
||||
boost::shared_ptr<named_subexpressions<From> > s)
|
||||
{
|
||||
typedef typename boost::is_same<To, From>::type tag_type;
|
||||
return convert_to_named_subs_imp<To>(s, tag_type());
|
||||
}
|
||||
//
|
||||
// class regex_data:
|
||||
// represents the data we wish to expose to the matching algorithms.
|
||||
//
|
||||
template <class charT, class traits>
|
||||
struct regex_data
|
||||
struct regex_data : public named_subexpressions<charT>
|
||||
{
|
||||
typedef regex_constants::syntax_option_type flag_type;
|
||||
typedef std::size_t size_type;
|
||||
@ -520,6 +633,10 @@ public:
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_data();
|
||||
}
|
||||
boost::shared_ptr<re_detail::named_subexpressions<charT> > get_named_subs()const
|
||||
{
|
||||
return m_pimpl;
|
||||
}
|
||||
|
||||
private:
|
||||
shared_ptr<re_detail::basic_regex_implementation<charT, traits> > m_pimpl;
|
||||
|
@ -777,6 +777,15 @@ escape_type_class_jump:
|
||||
}
|
||||
const charT* pc = m_position;
|
||||
int i = this->m_traits.toi(pc, m_end, 10);
|
||||
if(i < 0)
|
||||
{
|
||||
// Check for a named capture:
|
||||
const charT* base = m_position;
|
||||
while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
|
||||
++m_position;
|
||||
i = this->m_pdata->get_id(base, m_position);
|
||||
pc = m_position;
|
||||
}
|
||||
if(negative)
|
||||
i = 1 + m_mark_count - i;
|
||||
if((i > 0) && (this->m_backrefs & (1u << (i-1))))
|
||||
@ -1784,6 +1793,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
regex_constants::syntax_option_type old_flags = this->flags();
|
||||
bool old_case_change = m_has_case_change;
|
||||
m_has_case_change = false;
|
||||
charT name_delim;
|
||||
//
|
||||
// select the actual extension used:
|
||||
//
|
||||
@ -1825,8 +1835,10 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
pb->index = markid = -1;
|
||||
else
|
||||
{
|
||||
fail(regex_constants::error_badrepeat, m_position - m_base);
|
||||
return false;
|
||||
// Probably a named capture which also starts (?< :
|
||||
name_delim = '>';
|
||||
--m_position;
|
||||
goto named_capture_jump;
|
||||
}
|
||||
++m_position;
|
||||
jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
|
||||
@ -1903,7 +1915,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
|
||||
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
|
||||
{
|
||||
fail(regex_constants::error_badrepeat, m_position - m_base);
|
||||
fail(regex_constants::error_paren, m_position - m_base);
|
||||
return false;
|
||||
}
|
||||
m_position -= 2;
|
||||
@ -1914,6 +1926,40 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
case regex_constants::syntax_close_mark:
|
||||
fail(regex_constants::error_badrepeat, m_position - m_base);
|
||||
return false;
|
||||
case regex_constants::escape_type_end_buffer:
|
||||
{
|
||||
name_delim = *m_position;
|
||||
named_capture_jump:
|
||||
markid = 0;
|
||||
if(0 == (this->flags() & regbase::nosubs))
|
||||
{
|
||||
markid = ++m_mark_count;
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
if(this->flags() & regbase::save_subexpression_location)
|
||||
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 2, 0));
|
||||
#else
|
||||
if(this->flags() & regbase::save_subexpression_location)
|
||||
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>((m_position - m_base) - 2, 0));
|
||||
#endif
|
||||
}
|
||||
pb->index = markid;
|
||||
const charT* base = ++m_position;
|
||||
if(m_position == m_end)
|
||||
{
|
||||
fail(regex_constants::error_paren, m_position - m_base);
|
||||
return false;
|
||||
}
|
||||
while((m_position != m_end) && (*m_position != name_delim))
|
||||
++m_position;
|
||||
if(m_position == m_end)
|
||||
{
|
||||
fail(regex_constants::error_paren, m_position - m_base);
|
||||
return false;
|
||||
}
|
||||
this->m_pdata->set_name(base, m_position, markid);
|
||||
++m_position;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//
|
||||
// lets assume that we have a (?imsx) group and try and parse it:
|
||||
@ -2043,6 +2089,22 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
// and the case change data:
|
||||
//
|
||||
m_has_case_change = old_case_change;
|
||||
|
||||
if(markid > 0)
|
||||
{
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
if(this->flags() & regbase::save_subexpression_location)
|
||||
this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position) - 1;
|
||||
#else
|
||||
if(this->flags() & regbase::save_subexpression_location)
|
||||
this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base) - 1;
|
||||
#endif
|
||||
//
|
||||
// allow backrefs to this mark:
|
||||
//
|
||||
if((markid > 0) && (markid < (int)(sizeof(unsigned) * CHAR_BIT)))
|
||||
this->m_backrefs |= 1u << (markid - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,13 @@ namespace boost{
|
||||
#pragma warning(disable : 4251 4231 4660)
|
||||
#endif
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
template <class charT>
|
||||
class named_subexpressions;
|
||||
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
class match_results
|
||||
{
|
||||
@ -62,13 +69,14 @@ public:
|
||||
typedef typename re_detail::regex_iterator_traits<
|
||||
BidiIterator>::value_type char_type;
|
||||
typedef std::basic_string<char_type> string_type;
|
||||
typedef re_detail::named_subexpressions_base<char_type> named_sub_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit match_results(const Allocator& a = Allocator())
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
: m_subs(a), m_base() {}
|
||||
: m_subs(a), m_base(), m_last_closed_paren(0) {}
|
||||
#else
|
||||
: m_subs(), m_base() { (void)a; }
|
||||
: m_subs(), m_base(), m_last_closed_paren(0) { (void)a; }
|
||||
#endif
|
||||
match_results(const match_results& m)
|
||||
: m_subs(m.m_subs), m_base(m.m_base) {}
|
||||
@ -95,6 +103,24 @@ public:
|
||||
return m_subs[sub].length();
|
||||
return 0;
|
||||
}
|
||||
difference_type length(const char_type* sub) const
|
||||
{
|
||||
const char_type* end = sub;
|
||||
while(*end) ++end;
|
||||
return length(named_subexpression_index(sub, end));
|
||||
}
|
||||
template <class charT>
|
||||
difference_type length(const charT* sub) const
|
||||
{
|
||||
const charT* end = sub;
|
||||
while(*end) ++end;
|
||||
return length(named_subexpression_index(sub, end));
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type length(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return length(sub.c_str());
|
||||
}
|
||||
difference_type position(size_type sub = 0) const
|
||||
{
|
||||
sub += 2;
|
||||
@ -108,6 +134,24 @@ public:
|
||||
}
|
||||
return ~static_cast<difference_type>(0);
|
||||
}
|
||||
difference_type position(const char_type* sub) const
|
||||
{
|
||||
const char_type* end = sub;
|
||||
while(*end) ++end;
|
||||
return position(named_subexpression_index(sub, end));
|
||||
}
|
||||
template <class charT>
|
||||
difference_type position(const charT* sub) const
|
||||
{
|
||||
const charT* end = sub;
|
||||
while(*end) ++end;
|
||||
return position(named_subexpression_index(sub, end));
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
difference_type position(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return position(sub.c_str());
|
||||
}
|
||||
string_type str(int sub = 0) const
|
||||
{
|
||||
sub += 2;
|
||||
@ -122,6 +166,25 @@ public:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
string_type str(const char_type* sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class Traits, class A>
|
||||
string_type str(const std::basic_string<char_type, Traits, A>& sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class charT>
|
||||
string_type str(const charT* sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
string_type str(const std::basic_string<charT, Traits, A>& sub) const
|
||||
{
|
||||
return (*this)[sub].str();
|
||||
}
|
||||
const_reference operator[](int sub) const
|
||||
{
|
||||
sub += 2;
|
||||
@ -131,6 +194,75 @@ public:
|
||||
}
|
||||
return m_null;
|
||||
}
|
||||
//
|
||||
// Named sub-expressions:
|
||||
//
|
||||
const_reference named_subexpression(const char_type* i, const char_type* j) const
|
||||
{
|
||||
int index = m_named_subs->get_id(i, j);
|
||||
return index > 0 ? (*this)[index] : m_null;
|
||||
}
|
||||
template <class charT>
|
||||
const_reference named_subexpression(const charT* i, const charT* j) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(i == j)
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
while(i != j)
|
||||
s.insert(s.end(), *i++);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
int named_subexpression_index(const char_type* i, const char_type* j) const
|
||||
{
|
||||
int index = m_named_subs->get_id(i, j);
|
||||
return index > 0 ? index : -20;
|
||||
}
|
||||
template <class charT>
|
||||
int named_subexpression_index(const charT* i, const charT* j) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(i == j)
|
||||
return -20;
|
||||
std::vector<char_type> s;
|
||||
while(i != j)
|
||||
s.insert(s.end(), *i++);
|
||||
return named_subexpression_index(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
template <class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<char_type, Traits, A>& s) const
|
||||
{
|
||||
return named_subexpression(s.c_str(), s.c_str() + s.size());
|
||||
}
|
||||
const_reference operator[](const char_type* p) const
|
||||
{
|
||||
const char_type* e = p;
|
||||
while(*e) ++e;
|
||||
return named_subexpression(p, e);
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
const_reference operator[](const charT* p) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(*p == 0)
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
while(*p)
|
||||
s.insert(s.end(), *p++);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
template <class charT, class Traits, class A>
|
||||
const_reference operator[](const std::basic_string<charT, Traits, A>& ns) const
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
|
||||
if(ns.empty())
|
||||
return m_null;
|
||||
std::vector<char_type> s;
|
||||
for(unsigned i = 0; i < ns.size(); ++i)
|
||||
s.insert(s.end(), ns[i]);
|
||||
return named_subexpression(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
|
||||
const_reference prefix() const
|
||||
{
|
||||
@ -186,6 +318,10 @@ public:
|
||||
::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
|
||||
return result;
|
||||
}
|
||||
const_reference get_last_closed_paren()const
|
||||
{
|
||||
return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren];
|
||||
}
|
||||
|
||||
allocator_type get_allocator() const
|
||||
{
|
||||
@ -232,6 +368,8 @@ public:
|
||||
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
|
||||
{
|
||||
if(pos)
|
||||
m_last_closed_paren = pos;
|
||||
pos += 2;
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
@ -261,6 +399,7 @@ public:
|
||||
m_subs.insert(m_subs.end(), n+2-len, v);
|
||||
}
|
||||
m_subs[1].first = i;
|
||||
m_last_closed_paren = 0;
|
||||
}
|
||||
void BOOST_REGEX_CALL set_base(BidiIterator pos)
|
||||
{
|
||||
@ -301,11 +440,17 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL maybe_assign(const match_results<BidiIterator, Allocator>& m);
|
||||
|
||||
void BOOST_REGEX_CALL set_named_subs(boost::shared_ptr<named_sub_type> subs)
|
||||
{
|
||||
m_named_subs = subs;
|
||||
}
|
||||
|
||||
private:
|
||||
vector_type m_subs; // subexpressions
|
||||
BidiIterator m_base; // where the search started from
|
||||
sub_match<BidiIterator> m_null; // a null match
|
||||
boost::shared_ptr<named_sub_type> m_named_subs;
|
||||
int m_last_closed_paren;
|
||||
};
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
|
@ -200,6 +200,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
|
||||
m_match_flags |= regex_constants::match_all;
|
||||
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last);
|
||||
m_presult->set_base(base);
|
||||
m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs()));
|
||||
if(m_match_flags & match_posix)
|
||||
m_result = *m_presult;
|
||||
verify_options(re.flags(), m_match_flags);
|
||||
@ -261,6 +262,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::find_imp()
|
||||
pstate = re.get_first_state();
|
||||
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last);
|
||||
m_presult->set_base(base);
|
||||
m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs()));
|
||||
m_match_flags |= regex_constants::match_init;
|
||||
}
|
||||
else
|
||||
|
@ -107,6 +107,7 @@ private:
|
||||
void format_escape();
|
||||
void format_conditional();
|
||||
void format_until_scope_end();
|
||||
bool handle_perl_verb(bool have_brace);
|
||||
|
||||
const traits& m_traits; // the traits class for localised formatting operations
|
||||
const Results& m_results; // the match_results being used.
|
||||
@ -250,6 +251,25 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
case '$':
|
||||
put(*m_position++);
|
||||
break;
|
||||
case '+':
|
||||
if((++m_position != m_end) && (*m_position == '{'))
|
||||
{
|
||||
const char_type* base = ++m_position;
|
||||
while((m_position != m_end) && (*m_position != '}')) ++m_position;
|
||||
if(m_position != m_end)
|
||||
{
|
||||
// Named sub-expression:
|
||||
put(this->m_results.named_subexpression(base, m_position));
|
||||
++m_position;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_position = --base;
|
||||
}
|
||||
}
|
||||
put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
|
||||
break;
|
||||
case '{':
|
||||
have_brace = true;
|
||||
++m_position;
|
||||
@ -258,14 +278,18 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
// see if we have a number:
|
||||
{
|
||||
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
|
||||
//len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
|
||||
int v = m_traits.toi(m_position, m_position + len, 10);
|
||||
if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}'))))
|
||||
{
|
||||
// Look for a Perl-5.10 verb:
|
||||
if(!handle_perl_verb(have_brace))
|
||||
{
|
||||
// leave the $ as is, and carry on:
|
||||
m_position = --save_position;
|
||||
put(*m_position);
|
||||
++m_position;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// otherwise output sub v:
|
||||
@ -276,6 +300,123 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
}
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Results, class traits>
|
||||
bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bool have_brace)
|
||||
{
|
||||
//
|
||||
// We may have a capitalised string containing a Perl action:
|
||||
//
|
||||
static const char_type MATCH[] = { 'M', 'A', 'T', 'C', 'H' };
|
||||
static const char_type PREMATCH[] = { 'P', 'R', 'E', 'M', 'A', 'T', 'C', 'H' };
|
||||
static const char_type POSTMATCH[] = { 'P', 'O', 'S', 'T', 'M', 'A', 'T', 'C', 'H' };
|
||||
static const char_type LAST_PAREN_MATCH[] = { 'L', 'A', 'S', 'T', '_', 'P', 'A', 'R', 'E', 'N', '_', 'M', 'A', 'T', 'C', 'H' };
|
||||
static const char_type LAST_SUBMATCH_RESULT[] = { 'L', 'A', 'S', 'T', '_', 'S', 'U', 'B', 'M', 'A', 'T', 'C', 'H', '_', 'R', 'E', 'S', 'U', 'L', 'T' };
|
||||
static const char_type LAST_SUBMATCH_RESULT_ALT[] = { '^', 'N' };
|
||||
|
||||
if(have_brace && (*m_position == '^'))
|
||||
++m_position;
|
||||
|
||||
int max_len = m_end - m_position;
|
||||
|
||||
if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH))
|
||||
{
|
||||
m_position += 5;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 5;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put(this->m_results[0]);
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 8) && std::equal(m_position, m_position + 8, PREMATCH))
|
||||
{
|
||||
m_position += 8;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 8;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put(this->m_results.prefix());
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 9) && std::equal(m_position, m_position + 9, POSTMATCH))
|
||||
{
|
||||
m_position += 9;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 9;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put(this->m_results.suffix());
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 16) && std::equal(m_position, m_position + 16, LAST_PAREN_MATCH))
|
||||
{
|
||||
m_position += 16;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 16;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT))
|
||||
{
|
||||
m_position += 20;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 20;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put(this->m_results.get_last_closed_paren());
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 2) && std::equal(m_position, m_position + 2, LAST_SUBMATCH_RESULT_ALT))
|
||||
{
|
||||
m_position += 2;
|
||||
if(have_brace)
|
||||
{
|
||||
if(*m_position == '}')
|
||||
++m_position;
|
||||
else
|
||||
{
|
||||
m_position -= 2;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put(this->m_results.get_last_closed_paren());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Results, class traits>
|
||||
void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
|
||||
{
|
||||
|
@ -326,9 +326,9 @@ inline const charT* get_escape_R_string()
|
||||
#endif
|
||||
static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}',
|
||||
'\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')' };
|
||||
'\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
|
||||
static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')' };
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
|
||||
|
||||
charT c = static_cast<charT>(0x2029u);
|
||||
bool b = (static_cast<unsigned>(c) == 0x2029u);
|
||||
|
@ -537,7 +537,7 @@ BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_synta
|
||||
regex_constants::syntax_dollar, /*$*/
|
||||
regex_constants::syntax_char, /*%*/
|
||||
regex_constants::syntax_char, /*&*/
|
||||
regex_constants::syntax_char, /*'*/
|
||||
regex_constants::escape_type_end_buffer, /*'*/
|
||||
regex_constants::syntax_open_mark, /*(*/
|
||||
regex_constants::syntax_close_mark, /*)*/
|
||||
regex_constants::syntax_star, /***/
|
||||
|
@ -87,6 +87,10 @@ test-suite regex
|
||||
../build//boost_regex
|
||||
]
|
||||
|
||||
[ run named_subexpressions/named_subexpressions_test.cpp
|
||||
../build//boost_regex
|
||||
]
|
||||
|
||||
[ run unicode/unicode_iterator_test.cpp ../build//boost_regex ]
|
||||
[ run static_mutex/static_mutex_test.cpp
|
||||
../../thread/build//boost_thread ../build//boost_regex
|
||||
|
109
test/named_subexpressions/named_subexpressions_test.cpp
Normal file
109
test/named_subexpressions/named_subexpressions_test.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2009
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
|
||||
template <class charT>
|
||||
void test_named_subexpressions(charT)
|
||||
{
|
||||
//
|
||||
// Really this is just a test that the overloaded access functions work correctly:
|
||||
//
|
||||
static const charT e[] =
|
||||
{
|
||||
'(', '?', '\'', 'o', 'n', 'e', '\'', 'a', '+', ')', '(', '?', '<', 't', 'w', 'o', '>', 'b', '+', ')', '\0'
|
||||
};
|
||||
static const charT t[] =
|
||||
{
|
||||
'm', 'm', 'a', 'a', 'a', 'b', 'b', 'n', 'n', '\0'
|
||||
};
|
||||
static const charT one[] =
|
||||
{
|
||||
'o', 'n', 'e', '\0'
|
||||
};
|
||||
static const charT two[] =
|
||||
{
|
||||
't', 'w', 'o', '\0'
|
||||
};
|
||||
static const std::basic_string<charT> s_one(one);
|
||||
static const std::basic_string<charT> s_two(two);
|
||||
static const charT result1[] = { 'a', 'a', 'a', '\0' };
|
||||
static const charT result2[] = { 'b', 'b', '\0' };
|
||||
static const std::basic_string<charT> s_result1(result1);
|
||||
static const std::basic_string<charT> s_result2(result2);
|
||||
|
||||
static const char* c_one = "one";
|
||||
static const char* c_two = "two";
|
||||
static const std::string cs_one(c_one);
|
||||
static const std::string cs_two(c_two);
|
||||
|
||||
boost::basic_regex<charT> expression(e);
|
||||
boost::match_results<const charT*> what;
|
||||
if(regex_search(t, what, expression))
|
||||
{
|
||||
BOOST_CHECK(what.length(1) == 3);
|
||||
BOOST_CHECK(what.length(one) == 3);
|
||||
BOOST_CHECK(what.length(s_one) == 3);
|
||||
BOOST_CHECK(what.length(c_one) == 3);
|
||||
BOOST_CHECK(what.length(cs_one) == 3);
|
||||
BOOST_CHECK(what.position(1) == 2);
|
||||
BOOST_CHECK(what.position(one) == 2);
|
||||
BOOST_CHECK(what.position(s_one) == 2);
|
||||
BOOST_CHECK(what.position(c_one) == 2);
|
||||
BOOST_CHECK(what.position(cs_one) == 2);
|
||||
BOOST_CHECK(what.str(1) == s_result1);
|
||||
BOOST_CHECK(what.str(one) == s_result1);
|
||||
BOOST_CHECK(what.str(s_one) == s_result1);
|
||||
BOOST_CHECK(what.str(c_one) == s_result1);
|
||||
BOOST_CHECK(what.str(cs_one) == s_result1);
|
||||
BOOST_CHECK(what[1] == s_result1);
|
||||
BOOST_CHECK(what[one] == s_result1);
|
||||
BOOST_CHECK(what[s_one] == s_result1);
|
||||
BOOST_CHECK(what[c_one] == s_result1);
|
||||
BOOST_CHECK(what[cs_one] == s_result1);
|
||||
|
||||
BOOST_CHECK(what.length(2) == 2);
|
||||
BOOST_CHECK(what.length(two) == 2);
|
||||
BOOST_CHECK(what.length(s_two) == 2);
|
||||
BOOST_CHECK(what.length(c_two) == 2);
|
||||
BOOST_CHECK(what.length(cs_two) == 2);
|
||||
BOOST_CHECK(what.position(2) == 5);
|
||||
BOOST_CHECK(what.position(two) == 5);
|
||||
BOOST_CHECK(what.position(s_two) == 5);
|
||||
BOOST_CHECK(what.position(c_two) == 5);
|
||||
BOOST_CHECK(what.position(cs_two) == 5);
|
||||
BOOST_CHECK(what.str(2) == s_result2);
|
||||
BOOST_CHECK(what.str(two) == s_result2);
|
||||
BOOST_CHECK(what.str(s_two) == s_result2);
|
||||
BOOST_CHECK(what.str(c_two) == s_result2);
|
||||
BOOST_CHECK(what.str(cs_two) == s_result2);
|
||||
BOOST_CHECK(what[2] == s_result2);
|
||||
BOOST_CHECK(what[two] == s_result2);
|
||||
BOOST_CHECK(what[s_two] == s_result2);
|
||||
BOOST_CHECK(what[c_two] == s_result2);
|
||||
BOOST_CHECK(what[cs_two] == s_result2);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ERROR("Expected match not found");
|
||||
}
|
||||
}
|
||||
|
||||
int test_main( int , char* [] )
|
||||
{
|
||||
test_named_subexpressions(char(0));
|
||||
test_named_subexpressions(wchar_t(0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
@ -90,5 +90,18 @@ void test_backrefs()
|
||||
TEST_REGEX_SEARCH("a(b*)c\\g{-1}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("^(.)\\g{-1}", perl, "abc", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("a([bc])\\g{-1}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
|
||||
|
||||
// And again but with named subexpressions:
|
||||
TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, 1, 3, 1, 3, 1, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbd", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("^(?<foo>.)\\g{foo}", perl, "abc", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("a(?<foo>[bc])\\g{foo}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
|
||||
|
||||
TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, 1, 3, 1, 3, 1, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbd", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("^(?'foo'.)\\g{foo}", perl, "abc", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("a(?'foo'[bc])\\g{foo}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ void test_deprecated(const char&, const test_regex_search_tag&)
|
||||
int i = 0;
|
||||
while(results[2*i] != -2)
|
||||
{
|
||||
if(max_subs > i)
|
||||
if((int)max_subs > i)
|
||||
{
|
||||
if(results[2*i] != matches[i].rm_so)
|
||||
{
|
||||
@ -231,7 +231,7 @@ void test_deprecated(const wchar_t&, const test_regex_search_tag&)
|
||||
int i = 0;
|
||||
while(results[2*i] != -2)
|
||||
{
|
||||
if(max_subs > i)
|
||||
if((int)max_subs > i)
|
||||
{
|
||||
if(results[2*i] != matches[i].rm_so)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ void test_assertion_escapes()
|
||||
TEST_REGEX_SEARCH("\\R", perl, "foo\rbar", match_default, make_array(3, 4, -2, -2));
|
||||
TEST_REGEX_SEARCH("\\R", perl, "foo\r\nbar", match_default, make_array(3, 5, -2, -2));
|
||||
// see if \u works:
|
||||
const wchar_t* w = "\u2028";
|
||||
const wchar_t* w = L"\u2028";
|
||||
if(*w == 0x2028u)
|
||||
{
|
||||
TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2028bar", match_default, make_array(3, 4, -2, -2));
|
||||
|
@ -126,5 +126,53 @@ void test_replace()
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default, "/${10}/", "...//,,,");
|
||||
TEST_REGEX_REPLACE("((((((((((a+))))))))))", perl, "...aaa,,,", match_default, "/${10}/", ".../aaa/,,,");
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default, "/${1}0/", ".../aaa0/,,,");
|
||||
|
||||
// New Perl style operators:
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$MATCH", "aaa");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${MATCH}", "aaa");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^MATCH}", "aaa");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$MATC", "$MATC");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${MATCH", "${MATCH");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$PREMATCH", "...");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${PREMATCH}", "...");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^PREMATCH}", "...");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$PREMATC", "$PREMATC");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${PREMATCH", "${PREMATCH");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$POSTMATCH", ",,,");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${POSTMATCH}", ",,,");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^POSTMATCH}", ",,,");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$POSTMATC", "$POSTMATC");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${POSTMATCH", "${POSTMATCH");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATC", "$LAST_PAREN_MATC");
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "aaa");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "bb");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$+", "");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$+foo", "foo");
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$+", "aaa");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+foo", "bbfoo");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+{", "bb{");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+{foo", "bb{foo");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESUL", "$LAST_SUBMATCH_RESUL");
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "aaa");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "bb");
|
||||
TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "aaa");
|
||||
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "");
|
||||
TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "aaa");
|
||||
TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$^N", "bb");
|
||||
TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "aaa");
|
||||
|
||||
TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$&", "aabb");
|
||||
TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$1", "aa");
|
||||
TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$2", "bb");
|
||||
TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "d$+{one}c", "daac");
|
||||
TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "c$+{two}d", "cbbd");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user