forked from boostorg/regex
Initial commit of quickbook generated docs.
[SVN r37943]
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Background Information</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="ref/deprecated_interfaces/old_regex.html" title="High Level Class RegEx (Deprecated)">
|
||||
<link rel="next" href="background_information/headers.html" title="Headers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ref/deprecated_interfaces/old_regex.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="background_information/headers.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.background_information"></a><a href="background_information.html" title="Background Information">Background Information</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="background_information/headers.html"> Headers</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/locale.html"> Localization</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/thread_safety.html"> Thread
|
||||
Safety</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/examples.html"> Test and
|
||||
Example Programs</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/futher.html"> References
|
||||
and Further Information</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/faq.html"> FAQ</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/performance.html"> Performance</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/standards.html"> Standards
|
||||
Conformance</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/redist.html"> Redistributables</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/acknowledgements.html">
|
||||
Acknowledgements</a></span></dt>
|
||||
<dt><span class="section"><a href="background_information/history.html"> History</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ref/deprecated_interfaces/old_regex.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="background_information/headers.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,83 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Acknowledgements</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="redist.html" title="Redistributables">
|
||||
<link rel="next" href="history.html" title="History">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="redist.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.acknowledgements"></a><a href="acknowledgements.html" title="Acknowledgements">
|
||||
Acknowledgements</a></h3></div></div></div>
|
||||
<p>
|
||||
The author can be contacted at john - at - johnmaddock.co.uk; the home page
|
||||
for this library is at <a href="http://www.boost.org" target="_top">www.boost.org</a>.
|
||||
</p>
|
||||
<p>
|
||||
I am indebted to <a href="http://www.cs.princeton.edu/~rs/" target="_top">Robert Sedgewick's
|
||||
"Algorithms in C++"</a> for forcing me to think about algorithms
|
||||
and their performance, and to the folks at boost for forcing me to think,
|
||||
period.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://www.boost-consulting.com/" target="_top">Eric Niebler</a>, author
|
||||
of Boost.Expressive and the <a href="http://research.microsoft.com/projects/greta" target="_top">GRETA
|
||||
regular expression component</a>, has shared several important ideas,
|
||||
in a series of long discussions.
|
||||
</p>
|
||||
<p>
|
||||
Pete Becker, of <a href="http://www.versatilecoding.com" target="_top">Roundhouse Consulting,
|
||||
Ltd.</a>, has helped enormously with the standardisation proposal language.
|
||||
</p>
|
||||
<p>
|
||||
The following people have all contributed useful comments or fixes: Dave
|
||||
Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, Jan Bölsche,
|
||||
Beman Dawes, Paul Baxter, David Bergman, David Dennerline, Edward Diener,
|
||||
Peter Dimov, Robert Dunn, Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc
|
||||
Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy,
|
||||
Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko
|
||||
Schmidt, Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander
|
||||
Sokolovsky, Hervé Poirier, Michael Raykh, Marc Recht, Scott VanCamp, Bruno
|
||||
Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, Lealon Watts, John Wismar,
|
||||
Thomas Witt and Yuval Yosef.
|
||||
</p>
|
||||
<p>
|
||||
If I've missed your name off (I'm sure there are a few, just not who they
|
||||
are...) then please do get in touch.
|
||||
</p>
|
||||
<p>
|
||||
I am also grateful to the manuals supplied with the Henry Spencer, PCRE,
|
||||
Perl and GNU regular expression libraries - wherever possible I have tried
|
||||
to maintain compatibility with these libraries and with the POSIX standard
|
||||
- the code however is entirely my own, including any bugs! I can absolutely
|
||||
guarantee that I will not fix any bugs I don't know about, so if you have
|
||||
any comments or spot any bugs, please get in touch.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="redist.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,217 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Test and Example Programs</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="thread_safety.html" title="Thread Safety">
|
||||
<link rel="next" href="futher.html" title="References and Further Information">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="thread_safety.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="futher.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.examples"></a><a href="examples.html" title="Test and Example Programs"> Test and
|
||||
Example Programs</a></h3></div></div></div>
|
||||
<a name="boost_regex.background_information.examples.test_programs"></a><h5>
|
||||
<a name="id657467"></a>
|
||||
<a href="examples.html#boost_regex.background_information.examples.test_programs">Test
|
||||
Programs</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="bold"><strong>regress:</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
A regression test application that gives the matching/searching algorithms
|
||||
a full workout. The presence of this program is your guarantee that the library
|
||||
will behave as claimed - at least as far as those items tested are concerned
|
||||
- if anyone spots anything that isn't being tested I'd be glad to hear about
|
||||
it.
|
||||
</p>
|
||||
<p>
|
||||
Directory: <a href="../../../../test/regress" target="_top">libs/regex/test/regress</a>.
|
||||
</p>
|
||||
<p>
|
||||
Files: See directory.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>bad_expression_test:</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
Verifies that "bad" regular expressions don't cause the matcher
|
||||
to go into infinite loops, but to throw an exception instead.
|
||||
</p>
|
||||
<p>
|
||||
Directory: <a href="../../../../test/pathology" target="_top">libs/regex/test/pathology</a>.
|
||||
</p>
|
||||
<p>
|
||||
Files: <a href="../../../../test/pathology/bad_expression_test.cpp" target="_top">bad_expression_test.cpp</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>recursion_test:</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
Verifies that the matcher can't overrun the stack (no matter what the expression).
|
||||
</p>
|
||||
<p>
|
||||
Directory: <a href="../../../../test/pathology" target="_top">libs/regex/test/pathology</a>.
|
||||
</p>
|
||||
<p>
|
||||
Files: <a href="../../../../test/pathology/recursion_test.cpp" target="_top">recursion_test.cpp</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>concepts:</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
Verifies that the library meets all documented concepts (a compile only test).
|
||||
</p>
|
||||
<p>
|
||||
Directory: <a href="../../../../test/concepts" target="_top">libs/regex/test/concepts</a>.
|
||||
</p>
|
||||
<p>
|
||||
Files: <a href="../../../../test/concepts/concept_check.cpp" target="_top">concept_check.cpp</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>captures_test:</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
Test code for captures.
|
||||
</p>
|
||||
<p>
|
||||
Directory: <a href="../../../../test/captures" target="_top">libs/test/captures</a>.
|
||||
</p>
|
||||
<p>
|
||||
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="id657684"></a>
|
||||
<a href="examples.html#boost_regex.background_information.examples.example_programs">Example
|
||||
programs</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="bold"><strong>grep</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
A simple grep implementation, run with the -h command line option to find
|
||||
out its usage.
|
||||
</p>
|
||||
<p>
|
||||
Files: <a href="../../../../example/grep/grep.cpp" target="_top">grep.cpp</a>
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>timer.exe</strong></span>
|
||||
</p>
|
||||
<p>
|
||||
A simple interactive expression matching application, the results of all
|
||||
matches are timed, allowing the programmer to optimize their regular expressions
|
||||
where performance is critical.
|
||||
</p>
|
||||
<p>
|
||||
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="id657767"></a>
|
||||
<a href="examples.html#boost_regex.background_information.examples.code_snippets">Code
|
||||
snippets</a>
|
||||
</h5>
|
||||
<p>
|
||||
The snippets examples contain the code examples used in the documentation:
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/captures_example.cpp" target="_top">captures_example.cpp</a>:
|
||||
Demonstrates the use of captures.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/credit_card_example.cpp" target="_top">credit_card_example.cpp</a>:
|
||||
Credit card number formatting code.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/partial_regex_grep.cpp" target="_top">partial_regex_grep.cpp</a>:
|
||||
Search example using partial matches.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/partial_regex_match.cpp" target="_top">partial_regex_match.cpp</a>:
|
||||
regex_match example using partial matches.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_iterator_example.cpp" target="_top">regex_iterator_example.cpp</a>:
|
||||
Iterating through a series of matches.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_match_example.cpp" target="_top">regex_match_example.cpp</a>:
|
||||
ftp based regex_match example.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_merge_example.cpp" target="_top">regex_merge_example.cpp</a>:
|
||||
regex_merge example: converts a C++ file to syntax highlighted HTML.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_replace_example.cpp" target="_top">regex_replace_example.cpp</a>:
|
||||
regex_replace example: converts a C++ file to syntax highlighted HTML
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_search_example.cpp" target="_top">regex_search_example.cpp</a>:
|
||||
regex_search example: searches a cpp file for class definitions.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_token_iterator_eg_1.cpp" target="_top">regex_token_iterator_eg_1.cpp</a>:
|
||||
split a string into a series of tokens.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_token_iterator_eg_2.cpp" target="_top">regex_token_iterator_eg_2.cpp</a>:
|
||||
enumerate the linked URL's in a HTML file.
|
||||
</p>
|
||||
<p>
|
||||
The following are deprecated:
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_grep_example_1.cpp" target="_top">regex_grep_example_1.cpp</a>:
|
||||
regex_grep example 1: searches a cpp file for class definitions.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_grep_example_2.cpp" target="_top">regex_grep_example_2.cpp</a>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a
|
||||
global callback function.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_grep_example_3.cpp" target="_top">regex_grep_example_3.cpp</a>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a
|
||||
bound member function callback.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_grep_example_4.cpp" target="_top">regex_grep_example_4.cpp</a>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a
|
||||
C++ Builder closure as a callback.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_split_example_1.cpp" target="_top">regex_split_example_1.cpp</a>:
|
||||
regex_split example: split a string into tokens.
|
||||
</p>
|
||||
<p>
|
||||
<a href="../../../../example/snippets/regex_split_example_2.cpp" target="_top">regex_split_example_2.cpp</a>
|
||||
: regex_split example: spit out linked URL's.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="thread_safety.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="futher.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>FAQ</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="futher.html" title="References and Further Information">
|
||||
<link rel="next" href="performance.html" title="Performance">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="futher.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.faq"></a><a href="faq.html" title="FAQ"> FAQ</a></h3></div></div></div>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> I can't get regex++ to work with escape
|
||||
characters, what's going on?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> If you embed regular expressions in C++
|
||||
code, then remember that escape characters are processed twice: once by the
|
||||
C++ compiler, and once by the Boost.Regex expression compiler, so to pass
|
||||
the regular expression \d+ to Boost.Regex, you need to embed "\d+"
|
||||
in your code. Likewise to match a literal backslash you will need to embed
|
||||
"\\" in your code.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> No matter what I do regex_match always
|
||||
returns false, what's going on?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> The algorithm regex_match only succeeds
|
||||
if the expression matches <span class="bold"><strong>all</strong></span> of the text,
|
||||
if you want to <span class="bold"><strong>find</strong></span> a sub-string within
|
||||
the text that matches the expression then use regex_search instead.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> Why does using parenthesis in a POSIX
|
||||
regular expression change the result of a match?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> For POSIX (extended and basic) regular
|
||||
expressions, but not for perl regexes, parentheses don't only mark; they
|
||||
determine what the best match is as well. When the expression is compiled
|
||||
as a POSIX basic or extended regex then Boost.Regex follows the POSIX standard
|
||||
leftmost longest rule for determining what matched. So if there is more than
|
||||
one possible match after considering the whole expression, it looks next
|
||||
at the first sub-expression and then the second sub-expression and so on.
|
||||
So...
|
||||
</p>
|
||||
<p>
|
||||
"(0*)([0-9]*)" against "00123" would produce $1 = "00"
|
||||
$2 = "123"
|
||||
</p>
|
||||
<p>
|
||||
where as
|
||||
</p>
|
||||
<p>
|
||||
"0*([0-9])*" against "00123" would produce $1 = "00123"
|
||||
</p>
|
||||
<p>
|
||||
If you think about it, had $1 only matched the "123", this would
|
||||
be "less good" than the match "00123" which is both further
|
||||
to the left and longer. If you want $1 to match only the "123"
|
||||
part, then you need to use something like:
|
||||
</p>
|
||||
<p>
|
||||
"0*([1-9][0-9]*)"
|
||||
</p>
|
||||
<p>
|
||||
as the expression.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> Why don't character ranges work properly
|
||||
(POSIX mode only)?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> The POSIX standard specifies that character
|
||||
range expressions are locale sensitive - so for example the expression [A-Z]
|
||||
will match any collating element that collates between 'A' and 'Z'. That
|
||||
means that for most locales other than "C" or "POSIX",
|
||||
[A-Z] would match the single character 't' for example, which is not what
|
||||
most people expect - or at least not what most people have come to expect
|
||||
from regular expression engines. For this reason, the default behaviour of
|
||||
Boost.Regex (perl mode) is to turn locale sensitive collation off by not
|
||||
setting the <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">collate</span></code>
|
||||
compile time flag. However if you set a non-default compile time flag - for
|
||||
example <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">extended</span></code> or <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">basic</span></code>,
|
||||
then locale dependent collation will be enabled, this also applies to the
|
||||
POSIX API functions which use either <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">extended</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">basic</span></code> internally. [Note - when <code class="computeroutput"><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">nocollate</span></code> in effect, the library behaves
|
||||
"as if" the LC_COLLATE locale category were always "C",
|
||||
regardless of what its actually set to - end note].
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> Why are there no throw specifications
|
||||
on any of the functions? What exceptions can the library throw?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> Not all compilers support (or honor)
|
||||
throw specifications, others support them but with reduced efficiency. Throw
|
||||
specifications may be added at a later date as compilers begin to handle
|
||||
this better. The library should throw only three types of exception: [boost::regex_error]
|
||||
can be thrown by <a href="../ref/basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> when compiling a regular
|
||||
expression, <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> can be thrown when a call
|
||||
to <code class="computeroutput"><span class="identifier">basic_regex</span><span class="special">::</span><span class="identifier">imbue</span></code> tries to open a message catalogue
|
||||
that doesn't exist, or when a call to <a href="../ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a href="../ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> results in an "everlasting"
|
||||
search, or when a call to <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">GrepFiles</span></code>
|
||||
or <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">FindFiles</span></code> tries to open a file that cannot
|
||||
be opened, finally <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code> can be thrown by just about any
|
||||
of the functions in this library.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Q.</strong></span> Why can't I use the "convenience"
|
||||
versions of regex_match / regex_search / regex_grep / regex_format / regex_merge?
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>A.</strong></span> These versions may or may not be available
|
||||
depending upon the capabilities of your compiler, the rules determining the
|
||||
format of these functions are quite complex - and only the versions visible
|
||||
to a standard compliant compiler are given in the help. To find out what
|
||||
your compiler supports, run <boost/regex.hpp> through your C++ pre-processor,
|
||||
and search the output file for the function that you are interested in. Note
|
||||
however, that very few current compilers still have problems with these overloaded
|
||||
functions.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="futher.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>References and Further Information</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="examples.html" title="Test and Example Programs">
|
||||
<link rel="next" href="faq.html" title="FAQ">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="examples.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="faq.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.futher"></a><a href="futher.html" title="References and Further Information"> References
|
||||
and Further Information</a></h3></div></div></div>
|
||||
<p>
|
||||
Short tutorials on regular expressions can be <a href="http://etext.lib.virginia.edu/helpsheets/regex.html" target="_top">found
|
||||
here</a> and <a href="http://www.linuxpcug.org/lessons/regexp.html" target="_top">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
The main book on regular expressions is <a href="http://www.oreilly.com/catalog/regex/" target="_top">Mastering
|
||||
Regular Expressions, published by O'Reilly</a>.
|
||||
</p>
|
||||
<p>
|
||||
Boost.Regex forms the basis for the regular expression chapter of the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Technical
|
||||
report on C++ Library Extensions</a>.
|
||||
</p>
|
||||
<p>
|
||||
The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm" target="_top">Open
|
||||
Unix Specification</a> contains a wealth of useful material, including
|
||||
the POSIX regular expression syntax.
|
||||
</p>
|
||||
<p>
|
||||
The <a href="http://www.cs.ucr.edu/~stelo/pattern.html" target="_top">Pattern Matching
|
||||
Pointers</a> site is a "must visit" resource for anyone interested
|
||||
in pattern matching.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://glimpse.cs.arizona.edu/" target="_top">Glimpse and Agrep</a>, use
|
||||
a simplified regular expression syntax to achieve faster search times.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://glimpse.cs.arizona.edu/udi.html" target="_top">Udi Manber</a> and
|
||||
<a href="http://www.dcc.uchile.cl/~rbaeza/" target="_top">Ricardo Baeza-Yates</a>
|
||||
both have a selection of useful pattern matching papers available from their
|
||||
respective web sites.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="examples.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="faq.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Headers</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="../background_information.html" title="Background Information">
|
||||
<link rel="next" href="locale.html" title="Localization">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../background_information.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.headers"></a><a href="headers.html" title="Headers"> Headers</a></h3></div></div></div>
|
||||
<p>
|
||||
There are two main headers used by this library: <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">hpp</span><span class="special">></span></code>
|
||||
provides full access to the main template library, while <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cregex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
provides access to the (deprecated) high level class RegEx, and the POSIX
|
||||
API functions.
|
||||
</p>
|
||||
<p>
|
||||
There is also a header containing only forward declarations <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex_fwd</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
for use when an interface is dependent upon <a href="../ref/basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>, but otherwise does
|
||||
not need the full definitions.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../background_information.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,229 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>History</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="acknowledgements.html" title="Acknowledgements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="acknowledgements.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.history"></a><a href="history.html" title="History"> History</a></h3></div></div></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_34"></a><h5>
|
||||
<a name="id659964"></a>
|
||||
<a href="history.html#boost_regex.background_information.history.boost_1_34">Boost
|
||||
1.34</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Fix for non-greedy repeats and partial matches not working correctly in
|
||||
some cases.
|
||||
</li>
|
||||
<li>
|
||||
Fix for non-greedy repeats on VC++ not working in some cases (bug report
|
||||
1515830).
|
||||
</li>
|
||||
<li>
|
||||
Changed match_results::position() to return a valid result when *this represents
|
||||
a partial match.
|
||||
</li>
|
||||
<li>
|
||||
Fixed the grep and egrep options so that the newline character gets treated
|
||||
the same as |.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_33_1"></a><h5>
|
||||
<a name="id660017"></a>
|
||||
<a href="history.html#boost_regex.background_information.history.boost_1_33_1">Boost
|
||||
1.33.1</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Fixed broken makefiles.
|
||||
</li>
|
||||
<li>
|
||||
Fixed configuration setup to allow building with VC7.1 - STLport-4.6.2
|
||||
when using /Zc:wchar_t.
|
||||
</li>
|
||||
<li>
|
||||
Moved declarations class-inline in static_mutex.hpp so that SGI Irix compiler
|
||||
can cope.
|
||||
</li>
|
||||
<li>
|
||||
Added needed standard library #includes to fileiter.hpp, regex_workaround.hpp
|
||||
and cpp_regex_traits.hpp.
|
||||
</li>
|
||||
<li>
|
||||
Fixed a bug where non-greedy repeats could in certain strange curcumstances
|
||||
repeat more times than their maximum value.
|
||||
</li>
|
||||
<li>
|
||||
Fixed the value returned by basic_regex<>::empty() from a default
|
||||
constructed object.
|
||||
</li>
|
||||
<li>
|
||||
Changed the deffinition of regex_error to make it backwards compatible
|
||||
with Boost-1.32.0.
|
||||
</li>
|
||||
<li>
|
||||
Disabled external templates for Intel C++ 8.0 and earlier - otherwise unresolved
|
||||
references can occur.
|
||||
</li>
|
||||
<li>
|
||||
Rewritten extern template code for gcc so that only specific member functions
|
||||
are exported: otherwise strange unresolved references can occur when linking
|
||||
and mixing debug and non-debug code.
|
||||
</li>
|
||||
<li>
|
||||
Initialise all the data members of the unicode_iterators: this keeps gcc
|
||||
from issuing needless warnings.
|
||||
</li>
|
||||
<li>
|
||||
Ported the ICU integration code to VC6 and VC7.
|
||||
</li>
|
||||
<li>
|
||||
Ensured code is STLport debug mode clean.
|
||||
</li>
|
||||
<li>
|
||||
Fixed lookbehind assertions so that fixed length repeats are permitted,
|
||||
and so that regex iteration allows lookbehind to look back before the current
|
||||
search range (into the last match).
|
||||
</li>
|
||||
<li>
|
||||
Fixed strange bug with non-greedy repeats inside forward lookahead assertions.
|
||||
</li>
|
||||
<li>
|
||||
Enabled negated character classes inside character sets.
|
||||
</li>
|
||||
<li>
|
||||
Fixed regression so that [a-z-] is a valid expression again.
|
||||
</li>
|
||||
<li>
|
||||
Fixed bug that allowed some invalid expressions to be accepted.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_33_0"></a><h5>
|
||||
<a name="id660148"></a>
|
||||
<a href="history.html#boost_regex.background_information.history.boost_1_33_0">Boost
|
||||
1.33.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Completely rewritten expression parsing code, and traits class support;
|
||||
now conforms to the standardization proposal.
|
||||
</li>
|
||||
<li>
|
||||
Breaking Change: The syntax options that can be passed to basic_regex constructors
|
||||
have been rationalized. The default option (perl) now has a value of zero,
|
||||
and it is now clearly documented which options apply to which regular expression
|
||||
syntax styles (perl, POSIX-extended, POSIX-basic etc). Some of the more
|
||||
esoteric options have now been removed, so there is the possibility that
|
||||
existing code may fail to compile: however equivalent functionality should
|
||||
still be available.
|
||||
</li>
|
||||
<li>
|
||||
Breaking Change: POSIX-extended and POSIX-basic regular expressions now
|
||||
enforce the letter of the POSIX standard much more closely than before.
|
||||
</li>
|
||||
<li>
|
||||
Added support for (?imsx-imsx) constructs.
|
||||
</li>
|
||||
<li>
|
||||
Added support for lookbehind expressions (?<=positive-lookbehind) and
|
||||
(?<!negative-lookbehind).
|
||||
</li>
|
||||
<li>
|
||||
Added support for conditional expressions (?(assertion)true-expresion|false-expression).
|
||||
</li>
|
||||
<li>
|
||||
Added MFC/ATL string wrappers.
|
||||
</li>
|
||||
<li>
|
||||
Added Unicode support; based on ICU.
|
||||
</li>
|
||||
<li>
|
||||
Changed newline support to recognise \f as a line separator (all character
|
||||
types), and \x85 as a line separator for wide characters / Unicode only.
|
||||
</li>
|
||||
<li>
|
||||
Added a new format flag format_literal that treats the replace string as
|
||||
a literal, rather than a Perl or Sed style format string.
|
||||
</li>
|
||||
<li>
|
||||
Errors are now reported by throwing exceptions of type regex_error. The
|
||||
types used previously - bad_expression and bad_pattern - are now just typedefs
|
||||
for regex_error. Type regex_error has a couple of new members: code() to
|
||||
report an error code rather than a string, and position() to report where
|
||||
in the expression the error occured.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.background_information.history.boost_1_32_1"></a><h5>
|
||||
<a name="id660257"></a>
|
||||
<a href="history.html#boost_regex.background_information.history.boost_1_32_1">Boost
|
||||
1.32.1</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc"><li>
|
||||
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="id660292"></a>
|
||||
<a href="history.html#boost_regex.background_information.history.boost_1_31_0">Boost
|
||||
1.31.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Completely rewritten pattern matching code - it is now up to 10 times faster
|
||||
than before.
|
||||
</li>
|
||||
<li>
|
||||
Reorganized documentation.
|
||||
</li>
|
||||
<li>
|
||||
Deprecated all interfaces that are not part of the regular expression standardization
|
||||
proposal.
|
||||
</li>
|
||||
<li>
|
||||
Added regex_iterator and regex_token_iterator .
|
||||
</li>
|
||||
<li>
|
||||
Added support for Perl style independent sub-expressions.
|
||||
</li>
|
||||
<li>
|
||||
Added non-member operators to the sub_match class, so that you can compare
|
||||
sub_match's with strings, or add them to a string to produce a new string.
|
||||
</li>
|
||||
<li>
|
||||
Added experimental support for extended capture information.
|
||||
</li>
|
||||
<li>
|
||||
Changed the match flags so that they are a distinct type (not an integer),
|
||||
if you try to pass the match flags as an integer rather than match_flag_type
|
||||
to the regex algorithms then you will now get a compiler error.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="acknowledgements.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Performance</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="faq.html" title="FAQ">
|
||||
<link rel="next" href="standards.html" title="Standards Conformance">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="faq.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="standards.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.performance"></a><a href="performance.html" title="Performance"> Performance</a></h3></div></div></div>
|
||||
<p>
|
||||
The performance of Boost.Regex in both recursive and non-recursive modes
|
||||
should be broadly comparable to other regular expression libraries: recursive
|
||||
mode is slightly faster (especially where memory allocation requires thread
|
||||
synchronisation), but not by much. The following pages compare Boost.Regex
|
||||
with various other regular expression libraries for the following compilers:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<a href="../../../vc71-performance.html" target="_top">Visual Studio.Net 2003 (recursive
|
||||
Boost.Regex implementation)</a>.
|
||||
</li>
|
||||
<li>
|
||||
<a href="../../../gcc-performance.html" target="_top">Gcc 3.2 (cygwin) (non-recursive Boost.Regex
|
||||
implementation)</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="faq.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="standards.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Redistributables</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="standards.html" title="Standards Conformance">
|
||||
<link rel="next" href="acknowledgements.html" title="Acknowledgements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="standards.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.redist"></a><a href="redist.html" title="Redistributables"> Redistributables</a></h3></div></div></div>
|
||||
<p>
|
||||
If you are using Microsoft or Borland C++ and link to a dll version of the
|
||||
run time library, then you can choose to also link to a dll version of Boost.Regex
|
||||
by defining the symbol BOOST_REGEX_DYN_LINK when you compile your code. While
|
||||
these dll's are redistributable, there are no "standard" versions,
|
||||
so when installing on the users PC, you should place these in a directory
|
||||
private to your application, and not in the PC's directory path. Note that
|
||||
if you link to a static version of your run time library, then you will also
|
||||
link to a static version of Boost.Regex and no dll's will need to be distributed.
|
||||
The possible Boost.Regex dll and library names are computed according to
|
||||
the formula given in <a href="../../../../../../more/getting_started.html" target="_top">the
|
||||
getting started guide</a>.
|
||||
</p>
|
||||
<p>
|
||||
Note: you can disable automatic library selection by defining the symbol
|
||||
BOOST_REGEX_NO_LIB when compiling, this is useful if you want to build Boost.Regex
|
||||
yourself in your IDE, or if you need to debug Boost.Regex.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="standards.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,558 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Standards Conformance</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="performance.html" title="Performance">
|
||||
<link rel="next" href="redist.html" title="Redistributables">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="performance.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="redist.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.standards"></a><a href="standards.html" title="Standards Conformance"> Standards
|
||||
Conformance</a></h3></div></div></div>
|
||||
<a name="boost_regex.background_information.standards.c__"></a><h5>
|
||||
<a name="id658772"></a>
|
||||
<a href="standards.html#boost_regex.background_information.standards.c__">C++</a>
|
||||
</h5>
|
||||
<p>
|
||||
Boost.Regex is intended to conform to the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Technical
|
||||
report on C++ Library Extensions</a>.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.ecmascript___javascript"></a><h5>
|
||||
<a name="id658812"></a>
|
||||
<a href="standards.html#boost_regex.background_information.standards.ecmascript___javascript">ECMAScript
|
||||
/ JavaScript</a>
|
||||
</h5>
|
||||
<p>
|
||||
All of the ECMAScript regular expression syntax features are supported, except
|
||||
that:
|
||||
</p>
|
||||
<p>
|
||||
The escape sequence \u matches any upper case character (the same as [[:upper:]])
|
||||
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="id658853"></a>
|
||||
<a href="standards.html#boost_regex.background_information.standards.perl">Perl</a>
|
||||
</h5>
|
||||
<p>
|
||||
Almost all Perl features are supported, except for:
|
||||
</p>
|
||||
<p>
|
||||
(?{code}) Not implementable in a compiled strongly typed language.
|
||||
</p>
|
||||
<p>
|
||||
(??{code}) Not implementable in a compiled strongly typed language.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.posix"></a><h5>
|
||||
<a name="id658894"></a>
|
||||
<a href="standards.html#boost_regex.background_information.standards.posix">POSIX</a>
|
||||
</h5>
|
||||
<p>
|
||||
All the POSIX basic and extended regular expression features are supported,
|
||||
except that:
|
||||
</p>
|
||||
<p>
|
||||
No character collating names are recognized except those specified in the
|
||||
POSIX standard for the C locale, unless they are explicitly registered with
|
||||
the traits class.
|
||||
</p>
|
||||
<p>
|
||||
Character equivalence classes ( [[=a=]] etc) are probably buggy except on
|
||||
Win32. Implementing this feature requires knowledge of the format of the
|
||||
string sort keys produced by the system; if you need this, and the default
|
||||
implementation doesn't work on your platform, then you will need to supply
|
||||
a custom traits class.
|
||||
</p>
|
||||
<a name="boost_regex.background_information.standards.unicode"></a><h5>
|
||||
<a name="id658939"></a>
|
||||
<a href="standards.html#boost_regex.background_information.standards.unicode">Unicode</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following comments refer to <a href="http://unicode.org/reports/tr18/" target="_top">Unicode
|
||||
Technical Standard #18: Unicode Regular Expressions version 11</a>.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Item
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Feature
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Support
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Hex Notation
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes: use \x{DDDD} to refer to code point UDDDD.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Character Properties
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
All the names listed under the General Category Property are supported.
|
||||
Script names and Other Names are not currently supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.3
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Subtraction and Intersection
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Indirectly support by forward-lookahead:
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(?=[[:</span><span class="identifier">X</span><span class="special">:]])[[:</span><span class="identifier">Y</span><span class="special">:]]</span></code>
|
||||
</p>
|
||||
<p>
|
||||
Gives the intersection of character properties X and Y.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(?![[:</span><span class="identifier">X</span><span class="special">:]])[[:</span><span class="identifier">Y</span><span class="special">:]]</span></code>
|
||||
</p>
|
||||
<p>
|
||||
Gives everything in Y that is not in X (subtraction).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.4
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Simple Word Boundaries
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Conforming: non-spacing marks are included in the set of word characters.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.5
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Caseless Matching
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported, note that at this level, case transformations are 1:1,
|
||||
many to many case folding operations are not supported (for example
|
||||
"ß" to "SS").
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.6
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Line Boundaries
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported, except that "." matches only one character of
|
||||
"\r\n". Other than that word boundaries match correctly;
|
||||
including not matching in the middle of a "\r\n" sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
1.7
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Code Points
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported: provided you use the u32* algorithms, then UTF-8, UTF-16
|
||||
and UTF-32 are all treated as sequences of 32-bit code points.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Canonical Equivalence
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not supported: it is up to the user of the library to convert all
|
||||
text into the same canonical form as the regular expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default Grapheme Clusters
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.3Default Word Boundaries
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not supported.
|
||||
</p>
|
||||
</td>
|
||||
<td class="auto-generated"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.4
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default Loose Matches
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.5
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Named Properties
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported: the expression "[[:name:]]" or \N{name} matches
|
||||
the named character "name".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
2.6
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Wildcard properties
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tailored Punctuation.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tailored Grapheme Clusters
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.3
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tailored Word Boundaries.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.4
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tailored Loose Matches
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Partial support: [[=c=]] matches characters with the same primary
|
||||
equivalence class as "c".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.5
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tailored Ranges
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported: [a-b] matches any character that collates in the range
|
||||
a to b, when the expression is constructed with the collate flag
|
||||
set.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.6
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Context Matches
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.7
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Incremental Matches
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Supported: pass the flag <code class="computeroutput"><span class="identifier">match_partial</span></code>
|
||||
to the regex algorithms.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.8
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Unicode Set Sharing
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.9
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Possible Match Sets
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not supported, however this information is used internally to optimise
|
||||
the matching of regular expressions, and return quickly if no match
|
||||
is possible.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.10
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Folded Matching
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Partial Support: It is possible to achieve a similar effect by using
|
||||
a custom regular expression traits class.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
3.11
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Custom Submatch Evaluation
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="performance.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="redist.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Thread Safety</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../background_information.html" title="Background Information">
|
||||
<link rel="prev" href="locale.html" title="Localization">
|
||||
<link rel="next" href="examples.html" title="Test and Example Programs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="locale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.background_information.thread_safety"></a><a href="thread_safety.html" title="Thread Safety"> Thread
|
||||
Safety</a></h3></div></div></div>
|
||||
<p>
|
||||
The Boost.Regex library is thread safe when Boost is: you can verify that
|
||||
Boost is in thread safe mode by checking to see if <code class="computeroutput"><span class="identifier">BOOST_HAS_THREADS</span></code>
|
||||
is defined: this macro is set automatically by the config system when threading
|
||||
support is turned on in your compiler.
|
||||
</p>
|
||||
<p>
|
||||
Class <a href="../ref/basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>
|
||||
and its typedefs regex and wregex are thread safe, in that compiled regular
|
||||
expressions can safely be shared between threads. The matching algorithms
|
||||
<a href="../ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>,
|
||||
<a href="../ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>,
|
||||
and <a href="../ref/regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a>
|
||||
are all re-entrant and thread safe. Class <a href="../ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> is now thread safe,
|
||||
in that the results of a match can be safely copied from one thread to another
|
||||
(for example one thread may find matches and push <a href="../ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> instances onto a queue,
|
||||
while another thread pops them off the other end), otherwise use a separate
|
||||
instance of <a href="../ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>
|
||||
per thread.
|
||||
</p>
|
||||
<p>
|
||||
The <a href="../ref/posix.html" title="POSIX Compatible C API's">POSIX API functions</a> are
|
||||
all re-entrant and thread safe, regular expressions compiled with regcomp
|
||||
can also be shared between threads.
|
||||
</p>
|
||||
<p>
|
||||
The <a href="../ref/deprecated_interfaces/old_regex.html" title="High Level Class RegEx (Deprecated)">class
|
||||
RegEx</a> is only thread safe if each thread gets its own RegEx instance
|
||||
(apartment threading) - this is a consequence of RegEx handling both compiling
|
||||
and matching regular expressions.
|
||||
</p>
|
||||
<p>
|
||||
Finally note that changing the global locale invalidates all compiled regular
|
||||
expressions, therefore calling <code class="computeroutput"><span class="identifier">set_locale</span></code>
|
||||
from one thread while another uses regular expressions will produce unpredictable
|
||||
results.
|
||||
</p>
|
||||
<p>
|
||||
There is also a requirement that there is only one thread executing prior
|
||||
to the start of main().
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="locale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../background_information.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,380 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Understanding Marked Sub-Expressions and Captures</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="unicode.html" title="Unicode and Boost.Regex">
|
||||
<link rel="next" href="partial_matches.html" title="Partial Matches">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_matches.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.captures"></a><a href="captures.html" title="Understanding Marked Sub-Expressions and Captures"> Understanding Marked Sub-Expressions
|
||||
and Captures</a></h2></div></div></div>
|
||||
<p>
|
||||
Captures are the iterator ranges that are "captured" by marked sub-expressions
|
||||
as a regular expression gets matched. Each marked sub-expression can result
|
||||
in more than one capture, if it is matched more than once. This document explains
|
||||
how captures and marked sub-expressions in Boost.Regex are represented and
|
||||
accessed.
|
||||
</p>
|
||||
<a name="boost_regex.captures.marked_sub_expressions"></a><h5>
|
||||
<a name="id502328"></a>
|
||||
<a href="captures.html#boost_regex.captures.marked_sub_expressions">Marked sub-expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
Every time a Perl regular expression contains a parenthesis group <code class="computeroutput"><span class="special">()</span></code>, it spits out an extra field, known as a
|
||||
marked sub-expression, for example the expression:
|
||||
</p>
|
||||
<pre class="programlisting">(\w+)\W+(\w+)</pre>
|
||||
<p>
|
||||
Has two marked sub-expressions (known as $1 and $2 respectively), in addition
|
||||
the complete match is known as $&, everything before the first match as
|
||||
$`, and everything after the match as $'. So if the above expression is searched
|
||||
for within <code class="computeroutput"><span class="string">"@abc def--"</span></code>,
|
||||
then we obtain:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Sub-expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Text found
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$`
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"@"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$&
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"abc def"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"abc"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"def"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$'
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"--"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
In Boost.Regex all these are accessible via the <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> class that gets filled
|
||||
in when calling one of the regular expression matching algorithms ( <a href="ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, <a href="ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>, or <a href="ref/regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>). So given:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">IteratorType</span><span class="special">></span> <span class="identifier">m</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
The Perl and Boost.Regex equivalents are as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Perl
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Boost.Regex
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$`
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$&
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">]</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">]</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$'
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
In Boost.Regex each sub-expression match is represented by a <a href="ref/sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> object, this is basically
|
||||
just a pair of iterators denoting the start and end position of the sub-expression
|
||||
match, but there are some additional operators provided so that objects of
|
||||
type <a href="ref/sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
behave a lot like a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code>: for example they are implicitly
|
||||
convertible to a <code class="computeroutput"><span class="identifier">basic_string</span></code>,
|
||||
they can be compared to a string, added to a string, or streamed out to an
|
||||
output stream.
|
||||
</p>
|
||||
<a name="boost_regex.captures.unmatched_sub_expressions"></a><h5>
|
||||
<a name="id502953"></a>
|
||||
<a href="captures.html#boost_regex.captures.unmatched_sub_expressions">Unmatched Sub-Expressions</a>
|
||||
</h5>
|
||||
<p>
|
||||
When a regular expression match is found there is no need for all of the marked
|
||||
sub-expressions to have participated in the match, for example the expression:
|
||||
</p>
|
||||
<pre class="programlisting">(abc)|(def)</pre>
|
||||
<p>
|
||||
can match either $1 or $2, but never both at the same time. In Boost.Regex
|
||||
you can determine which sub-expressions matched by accessing the <code class="computeroutput"><span class="identifier">sub_match</span><span class="special">::</span><span class="identifier">matched</span></code> data member.
|
||||
</p>
|
||||
<a name="boost_regex.captures.repeated_captures"></a><h5>
|
||||
<a name="id503019"></a>
|
||||
<a href="captures.html#boost_regex.captures.repeated_captures">Repeated Captures</a>
|
||||
</h5>
|
||||
<p>
|
||||
When a marked sub-expression is repeated, then the sub-expression gets "captured"
|
||||
multiple times, however normally only the final capture is available, for example
|
||||
if
|
||||
</p>
|
||||
<pre class="programlisting">(?:(\w+)\W+)+</pre>
|
||||
<p>
|
||||
is matched against
|
||||
</p>
|
||||
<pre class="programlisting">one fine day</pre>
|
||||
<p>
|
||||
Then $1 will contain the string "day", and all the previous captures
|
||||
will have been forgotten.
|
||||
</p>
|
||||
<p>
|
||||
However, Boost.Regex has an experimental feature that allows all the capture
|
||||
information to be retained - this is accessed either via the <code class="computeroutput"><span class="identifier">match_results</span><span class="special">::</span><span class="identifier">captures</span></code> member function or the <code class="computeroutput"><span class="identifier">sub_match</span><span class="special">::</span><span class="identifier">captures</span></code> member function. These functions
|
||||
return a container that contains a sequence of all the captures obtained during
|
||||
the regular expression matching. The following example program shows how this
|
||||
information may be used:
|
||||
</p>
|
||||
<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>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">print_captures</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">regx</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">text</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="identifier">regx</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Expression: \""</span> <span class="special"><<</span> <span class="identifier">regx</span> <span class="special"><<</span> <span class="string">"\"\n"</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Text: \""</span> <span class="special"><<</span> <span class="identifier">text</span> <span class="special"><<</span> <span class="string">"\"\n"</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_extra</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"** Match found **\n Sub-Expressions:\n"</span><span class="special">;</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" $"</span> <span class="special"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="string">" = \""</span> <span class="special"><<</span> <span class="identifier">what</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="string">"\"\n"</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" Captures:\n"</span><span class="special">;</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" $"</span> <span class="special"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="string">" = {"</span><span class="special">;</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special"><</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">captures</span><span class="special">(</span><span class="identifier">i</span><span class="special">).</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">", "</span><span class="special">;</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"\""</span> <span class="special"><<</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">captures</span><span class="special">(</span><span class="identifier">i</span><span class="special">)[</span><span class="identifier">j</span><span class="special">]</span> <span class="special"><<</span> <span class="string">"\""</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" }\n"</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"** No Match found **\n"</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="special">[])</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(([[:lower:]]+)|([[:upper:]]+))+"</span><span class="special">,</span> <span class="string">"aBBcccDDDDDeeeeeeee"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(.*)bar|(.*)bah"</span><span class="special">,</span> <span class="string">"abcbar"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"(.*)bar|(.*)bah"</span><span class="special">,</span> <span class="string">"abcbah"</span><span class="special">);</span>
|
||||
<span class="identifier">print_captures</span><span class="special">(</span><span class="string">"^(?:(\\w+)|(?>\\W+))*$"</span><span class="special">,</span>
|
||||
<span class="string">"now is the time for all good men to come to the aid of the party"</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Which produces the following output:
|
||||
</p>
|
||||
<pre class="programlisting">Expression: "(([[:lower:]]+)|([[:upper:]]+))+"
|
||||
Text: "aBBcccDDDDDeeeeeeee"
|
||||
** Match found **
|
||||
Sub-Expressions:
|
||||
$0 = "aBBcccDDDDDeeeeeeee"
|
||||
$1 = "eeeeeeee"
|
||||
$2 = "eeeeeeee"
|
||||
$3 = "DDDDD"
|
||||
Captures:
|
||||
$0 = { "aBBcccDDDDDeeeeeeee" }
|
||||
$1 = { "a", "BB", "ccc", "DDDDD", "eeeeeeee" }
|
||||
$2 = { "a", "ccc", "eeeeeeee" }
|
||||
$3 = { "BB", "DDDDD" }
|
||||
Expression: "(.*)bar|(.*)bah"
|
||||
Text: "abcbar"
|
||||
** Match found **
|
||||
Sub-Expressions:
|
||||
$0 = "abcbar"
|
||||
$1 = "abc"
|
||||
$2 = ""
|
||||
Captures:
|
||||
$0 = { "abcbar" }
|
||||
$1 = { "abc" }
|
||||
$2 = { }
|
||||
Expression: "(.*)bar|(.*)bah"
|
||||
Text: "abcbah"
|
||||
** Match found **
|
||||
Sub-Expressions:
|
||||
$0 = "abcbah"
|
||||
$1 = ""
|
||||
$2 = "abc"
|
||||
Captures:
|
||||
$0 = { "abcbah" }
|
||||
$1 = { }
|
||||
$2 = { "abc" }
|
||||
Expression: "^(?:(\w+)|(?>\W+))*$"
|
||||
Text: "now is the time for all good men to come to the aid of the party"
|
||||
** Match found **
|
||||
Sub-Expressions:
|
||||
$0 = "now is the time for all good men to come to the aid of the party"
|
||||
$1 = "party"
|
||||
Captures:
|
||||
$0 = { "now is the time for all good men to come to the aid of the party" }
|
||||
$1 = { "now", "is", "the", "time", "for", "all", "good", "men", "to",
|
||||
"come", "to", "the", "aid", "of", "the", "party" }
|
||||
</pre>
|
||||
<p>
|
||||
Unfortunately enabling this feature has an impact on performance (even if you
|
||||
don't use it), and a much bigger impact if you do use it, therefore to use
|
||||
this feature you need to:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Define BOOST_REGEX_MATCH_EXTRA for all translation units including the library
|
||||
source (the best way to do this is to uncomment this define in boost/regex/user.hpp
|
||||
and then rebuild everything.
|
||||
</li>
|
||||
<li>
|
||||
Pass the match_extra flag to the particular algorithms where you actually
|
||||
need the captures information (regex_search, regex_match, or regex_iterator).
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_matches.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,46 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Configuration</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="../index.html" title="Boost.Regex">
|
||||
<link rel="next" href="configuration/compiler.html" title="Compiler Setup">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="configuration/compiler.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.configuration"></a><a href="configuration.html" title="Configuration"> Configuration</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="configuration/compiler.html"> Compiler Setup</a></span></dt>
|
||||
<dt><span class="section"><a href="configuration/locale.html"> Locale and traits
|
||||
class selection</a></span></dt>
|
||||
<dt><span class="section"><a href="configuration/linkage.html"> Linkage Options</a></span></dt>
|
||||
<dt><span class="section"><a href="configuration/algorithm.html"> Algorithm Selection</a></span></dt>
|
||||
<dt><span class="section"><a href="configuration/tuning.html"> Algorithm Tuning</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="configuration/compiler.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Algorithm Selection</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="linkage.html" title="Linkage Options">
|
||||
<link rel="next" href="tuning.html" title="Algorithm Tuning">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="linkage.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tuning.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.algorithm"></a><a href="algorithm.html" title="Algorithm Selection"> Algorithm Selection</a></h3></div></div></div>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
macro
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_RECURSIVE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex to use a stack-recursive matching algorithm. This
|
||||
is generally the fastest option (although there is very little in
|
||||
it), but can cause stack overflow in extreme cases, on Win32 this
|
||||
can be handled safely, but this is not the case on other platforms.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_NON_RECURSIVE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex to use a non-stack recursive matching algorithm,
|
||||
this can be slightly slower than the alternative, but is always safe
|
||||
no matter how pathological the regular expression. This is the default
|
||||
on non-Win32 platforms.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="linkage.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tuning.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Compiler Setup</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="../configuration.html" title="Configuration">
|
||||
<link rel="next" href="locale.html" title="Locale and traits class selection">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../configuration.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.compiler"></a><a href="compiler.html" title="Compiler Setup"> Compiler Setup</a></h3></div></div></div>
|
||||
<p>
|
||||
You shouldn't need to do anything special to configure Boost.Regex for use
|
||||
with your compiler - the <a href="../../../../../config/index.html" target="_top">Boost.Config
|
||||
subsystem</a> should already take care of it, if you do have problems
|
||||
(or you are using a particularly obscure compiler or platform) then <a href="../../../../../config/index.html" target="_top">Boost.Config</a> has a configure script
|
||||
that you can run.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../configuration.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,86 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Linkage Options</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="locale.html" title="Locale and traits class selection">
|
||||
<link rel="next" href="algorithm.html" title="Algorithm Selection">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="locale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="algorithm.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.linkage"></a><a href="linkage.html" title="Linkage Options"> Linkage Options</a></h3></div></div></div>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
macro
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_DYN_LINK
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For Microsoft and Borland C++ builds, this tells Boost.Regex that
|
||||
it should link to the dll build of the Boost.Regex. By default boost.regex
|
||||
will link to its static library build, even if the dynamic C runtime
|
||||
library is in use.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_NO_LIB
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For Microsoft and Borland C++ builds, this tells Boost.Regex that
|
||||
it should not automatically select the library to link to.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="locale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="algorithm.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,104 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Locale and traits class selection</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="compiler.html" title="Compiler Setup">
|
||||
<link rel="next" href="linkage.html" title="Linkage Options">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="linkage.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.locale"></a><a href="locale.html" title="Locale and traits class selection"> Locale and traits
|
||||
class selection</a></h3></div></div></div>
|
||||
<p>
|
||||
The following macros (see <a href="../../../../../../boost/regex/user.hpp" target="_top">user.hpp</a>)
|
||||
control how Boost.Regex interacts with the user's locale:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
macro
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_USE_C_LOCALE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Forces Boost.Regex to use the global C locale in its traits class
|
||||
support: this is now deprecated in favour of the C++ locale.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_USE_CPP_LOCALE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Forces Boost.Regex to use std::locale in it's default traits class,
|
||||
regular expressions can then be imbued with an instance specific
|
||||
locale. This is the default behaviour on non-Windows platforms.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_NO_W32
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex not to use any Win32 API's even when available
|
||||
(implies BOOST_REGEX_USE_CPP_LOCALE unless BOOST_REGEX_USE_C_LOCALE
|
||||
is set).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="linkage.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Algorithm Tuning</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="algorithm.html" title="Algorithm Selection">
|
||||
<link rel="next" href="../install.html" title="Building and Installing the Library">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="algorithm.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../install.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.tuning"></a><a href="tuning.html" title="Algorithm Tuning"> Algorithm Tuning</a></h3></div></div></div>
|
||||
<p>
|
||||
The following option applies only if BOOST_REGEX_RECURSIVE is set.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
macro
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex that Microsoft style __try - __except blocks are
|
||||
supported, and can be used to safely trap stack overflow.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
macro
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_BLOCKSIZE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
In non-recursive mode, Boost.Regex uses largish blocks of memory
|
||||
to act as a stack for the state machine, the larger the block size
|
||||
then the fewer allocations that will take place. This defaults to
|
||||
4096 bytes, which is large enough to match the vast majority of regular
|
||||
expressions without further allocations, however, you can choose
|
||||
smaller or larger values depending upon your platforms characteristics.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_MAX_BLOCKS
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex how many blocks of size BOOST_REGEX_BLOCKSIZE it
|
||||
is permitted to use. If this value is exceeded then Boost.Regex will
|
||||
stop trying to find a match and throw a std::runtime_error. Defaults
|
||||
to 1024, don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE
|
||||
by much.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_REGEX_MAX_CACHE_BLOCKS
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Tells Boost.Regex how many memory blocks to store in it's internal
|
||||
cache - memory blocks are taken from this cache rather than by calling
|
||||
::operator new. Generally speeking this can be an order of magnitude
|
||||
faster than calling ::opertator new each time a memory block is required,
|
||||
but has the downside that Boost.Regex can end up caching a large
|
||||
chunk of memory (by default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE
|
||||
size). If memory is tight then try defining this to 0 (disables all
|
||||
caching), or if that is too slow, then a value of 1 or 2, may be
|
||||
sufficient. On the other hand, on large multi-processor, multi-threaded
|
||||
systems, you may find that a higher value is in order.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="algorithm.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../install.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,63 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Search and Replace Format String Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="syntax/leftmost_longest_rule.html" title="The Leftmost Longest Rule">
|
||||
<link rel="next" href="format/sed_format.html" title="Sed Format String Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax/leftmost_longest_rule.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="format/sed_format.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.format"></a><a href="format.html" title="Search and Replace Format String Syntax"> Search and Replace Format String Syntax</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="format/sed_format.html"> Sed Format String Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="format/perl_format.html"> Perl Format String Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="format/boost_format_syntax.html"> Boost-Extended
|
||||
Format String Syntax</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
Format strings are used by the algorithm <a href="ref/regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a> and by <a href="ref/match_results.html#boost_regex.match_results_format"><code class="computeroutput"><span class="identifier">match_results</span><span class="special"><>::</span><span class="identifier">format</span></code></a>, and are used to transform
|
||||
one string into another.
|
||||
</p>
|
||||
<p>
|
||||
There are three kind of format string: <a href="format/sed_format.html" title="Sed Format String Syntax">Sed</a>,
|
||||
<a href="format/perl_format.html" title="Perl Format String Syntax">Perl</a> and <a href="format/boost_format_syntax.html" title="Boost-Extended Format String Syntax">Boost-Extended</a>.
|
||||
</p>
|
||||
<p>
|
||||
Alternatively, when the flag <code class="computeroutput"><span class="identifier">format_literal</span></code>
|
||||
is passed to one of these functions, then the format string is treated as a
|
||||
string literal, and is copied unchanged to the output.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax/leftmost_longest_rule.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="format/sed_format.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,398 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Boost-Extended Format String Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../format.html" title="Search and Replace Format String Syntax">
|
||||
<link rel="prev" href="perl_format.html" title="Perl Format String Syntax">
|
||||
<link rel="next" href="../ref.html" title="Reference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="perl_format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.format.boost_format_syntax"></a><a href="boost_format_syntax.html" title="Boost-Extended Format String Syntax"> Boost-Extended
|
||||
Format String Syntax</a></h3></div></div></div>
|
||||
<p>
|
||||
Boost-Extended format strings treat all characters as literals except for
|
||||
'$', '\', '(', ')', '?', and ':'.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.grouping"></a><h5>
|
||||
<a name="id525164"></a>
|
||||
<a href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.grouping">Grouping</a>
|
||||
</h5>
|
||||
<p>
|
||||
The characters '(' and ')' perform lexical grouping, so use \( and \) if
|
||||
you want a to output literal parenthesis.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.conditionals"></a><h5>
|
||||
<a name="id525196"></a>
|
||||
<a href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.conditionals">Conditionals</a>
|
||||
</h5>
|
||||
<p>
|
||||
The character '?' begins a conditional expression, the general form is:
|
||||
</p>
|
||||
<p>
|
||||
?Ntrue-expression:false-expression
|
||||
</p>
|
||||
<p>
|
||||
where N is decimal digit.
|
||||
</p>
|
||||
<p>
|
||||
If sub-expression N was matched, then true-expression is evaluated and sent
|
||||
to output, otherwise false-expression is evaluated and sent to output.
|
||||
</p>
|
||||
<p>
|
||||
You will normally need to surround a conditional-expression with parenthesis
|
||||
in order to prevent ambiguities.
|
||||
</p>
|
||||
<p>
|
||||
For example, the format string "(?1foo:bar)" will replace each
|
||||
match found with "foo" if the sub-expression $1 was matched, and
|
||||
with "bar" otherwise.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.placeholder_sequences"></a><h5>
|
||||
<a name="id525255"></a>
|
||||
<a href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.placeholder_sequences">Placeholder
|
||||
Sequences</a>
|
||||
</h5>
|
||||
<p>
|
||||
Placeholder sequences specify that some part of what matched the regular
|
||||
expression should be sent to output as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Placeholder
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$&
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the whole expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$`
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$'
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs all the text following the end of the current match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$$
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a literal '$'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the n'th sub-expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Any $-placeholder sequence not listed above, results in '$' being treated
|
||||
as a literal.
|
||||
</p>
|
||||
<a name="boost_regex.format.boost_format_syntax.escape_sequences"></a><h5>
|
||||
<a name="id525428"></a>
|
||||
<a href="boost_format_syntax.html#boost_regex.format.boost_format_syntax.escape_sequences">Escape
|
||||
Sequences</a>
|
||||
</h5>
|
||||
<p>
|
||||
An escape character followed by any character x, outputs that character unless
|
||||
x is one of the escape sequences shown below.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Escape
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\a
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the bell character: '\a'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\e
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape character (code point 27).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\f
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a form feed character: '\f'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a newline character: '\n'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\r
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a carriage return character: '\r'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\t
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a tab character: '\t'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\v
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a vertical tab character: '\v'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\xDD
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\x{DDDD}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDDDDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\cX
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape sequence "escape-X".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\D
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If D is a decimal digit in the range 1-9, then outputs the text that
|
||||
matched sub-expression D.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\l
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the next character to be outputted, to be output in lower
|
||||
case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\u
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the next character to be outputted, to be output in upper
|
||||
case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\L
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes all subsequent characters to be output in lower case, until
|
||||
a \E is found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\U
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes all subsequent characters to be output in upper case, until
|
||||
a \E is found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\E
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Terminates a \L or \U sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="perl_format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,353 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Perl Format String Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../format.html" title="Search and Replace Format String Syntax">
|
||||
<link rel="prev" href="sed_format.html" title="Sed Format String Syntax">
|
||||
<link rel="next" href="boost_format_syntax.html" title="Boost-Extended Format String Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sed_format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="boost_format_syntax.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.format.perl_format"></a><a href="perl_format.html" title="Perl Format String Syntax"> Perl Format String Syntax</a></h3></div></div></div>
|
||||
<p>
|
||||
Perl-style format strings treat all characters as literals except '$' and
|
||||
'\' which start placeholder and escape sequences respectively.
|
||||
</p>
|
||||
<p>
|
||||
Placeholder sequences specify that some part of what matched the regular
|
||||
expression should be sent to output as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Placeholder
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$&
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the whole expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$`
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$'
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs all the text following the end of the current match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$$
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a literal '$'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
$n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs what matched the n'th sub-expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Any $-placeholder sequence not listed above, results in '$' being treated
|
||||
as a literal.
|
||||
</p>
|
||||
<p>
|
||||
An escape character followed by any character x, outputs that character unless
|
||||
x is one of the escape sequences shown below.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Escape
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\a
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the bell character: '\a'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\e
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape character (code point 27).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\f
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a form feed character: '\f'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a newline character: '\n'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\r
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a carriage return character: '\r'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\t
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a tab character: '\t'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\v
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a vertical tab character: '\v'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\xDD
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\x{DDDD}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDDDDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\cX
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape sequence "escape-X".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\D
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If D is a decimal digit in the range 1-9, then outputs the text that
|
||||
matched sub-expression D.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\l
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the next character to be outputted, to be output in lower
|
||||
case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\u
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the next character to be outputted, to be output in upper
|
||||
case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\L
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes all subsequent characters to be output in lower case, until
|
||||
a \E is found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\U
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes all subsequent characters to be output in upper case, until
|
||||
a \E is found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\E
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Terminates a \L or \U sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sed_format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="boost_format_syntax.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,244 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Sed Format String Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../format.html" title="Search and Replace Format String Syntax">
|
||||
<link rel="prev" href="../format.html" title="Search and Replace Format String Syntax">
|
||||
<link rel="next" href="perl_format.html" title="Perl Format String Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="perl_format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.format.sed_format"></a><a href="sed_format.html" title="Sed Format String Syntax"> Sed Format String Syntax</a></h3></div></div></div>
|
||||
<p>
|
||||
Sed-style format strings treat all characters as literals except:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
character
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
&
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The ampersand character is replaced in the output stream by the the
|
||||
whole of what matched the regular expression. Use \& to output
|
||||
a literal '&' character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies an escape sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
An escape character followed by any character x, outputs that character unless
|
||||
x is one of the escape sequences shown below.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Escape
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\a
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the bell character: '\a'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\e
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape character (code point 27).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\f
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a form feed character: '\f'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\n
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a newline character: '\n'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\r
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a carriage return character: '\r'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\t
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a tab character: '\t'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\v
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs a vertical tab character: '\v'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\xDD
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\x{DDDD}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the character whose hexadecimal code point is 0xDDDDD
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\cX
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Outputs the ANSI escape sequence "escape-X".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\D
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If D is a decimal digit in the range 1-9, then outputs the text that
|
||||
matched sub-expression D.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../format.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../format.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="perl_format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,367 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Building and Installing the Library</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="configuration/tuning.html" title="Algorithm Tuning">
|
||||
<link rel="next" href="introduction_and_overview.html" title="Introduction and Overview">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="configuration/tuning.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="introduction_and_overview.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.install"></a><a href="install.html" title="Building and Installing the Library"> Building and Installing the Library</a></h2></div></div></div>
|
||||
<p>
|
||||
When you extract the library from its zip file, you must preserve its internal
|
||||
directory structure (for example by using the -d option when extracting). If
|
||||
you didn't do that when extracting, then you'd better stop reading this, delete
|
||||
the files you just extracted, and try again!
|
||||
</p>
|
||||
<p>
|
||||
This library should not need configuring before use; most popular compilers/standard
|
||||
libraries/platforms are already supported "as is". If you do experience
|
||||
configuration problems, or just want to test the configuration with your compiler,
|
||||
then the process is the same as for all of boost; see the <a href="../../../../config/index.html" target="_top">configuration
|
||||
library documentation</a>.
|
||||
</p>
|
||||
<p>
|
||||
The library will encase all code inside namespace boost.
|
||||
</p>
|
||||
<p>
|
||||
Unlike some other template libraries, this library consists of a mixture of
|
||||
template code (in the headers) and static code and data (in cpp files). Consequently
|
||||
it is necessary to build the library's support code into a library or archive
|
||||
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="id428531"></a>
|
||||
<a href="install.html#boost_regex.install.building_with_bjam">Building with bjam</a>
|
||||
</h5>
|
||||
<p>
|
||||
This is now the preferred method for building and installing this library,
|
||||
please refer to the <a href="../../../../../more/getting_started.html" target="_top">getting
|
||||
started guide</a> for more information.
|
||||
</p>
|
||||
<a name="boost_regex.install.building_with_unicode_and_icu_support"></a><h5>
|
||||
<a name="id428567"></a>
|
||||
<a href="install.html#boost_regex.install.building_with_unicode_and_icu_support">Building
|
||||
With Unicode and ICU Support</a>
|
||||
</h5>
|
||||
<p>
|
||||
A default build of this library does not enable Unciode support via ICU. There
|
||||
is no need to enable this support if you don't need it, but if you use ICU
|
||||
for your Unicode support already, and want to work with Unicode-aware regular
|
||||
expressions then read on.
|
||||
</p>
|
||||
<p>
|
||||
Most of the information you will need is in the getting started guide, the
|
||||
only additional step you need to take is to tell bjam that you want Boost.Regex
|
||||
to use ICU and optionally to tell bjam where ICU is located.
|
||||
</p>
|
||||
<p>
|
||||
If you're building on a Unix-like platform, and ICU is already installed in
|
||||
your compilers search path (with an install prefix of <code class="computeroutput"><span class="special">/</span><span class="identifier">usr</span></code> or <code class="computeroutput"><span class="special">/</span><span class="identifier">usr</span><span class="special">/</span><span class="identifier">local</span></code>
|
||||
for example), then set the environment variable <code class="computeroutput"><span class="identifier">HAVE_ICU</span></code>
|
||||
to enable ICU support. For example you might build with the command line:
|
||||
</p>
|
||||
<pre class="programlisting">bjam -sHAVE_ICU=1 --toolset=toolset-name install</pre>
|
||||
<p>
|
||||
If ICU is not already in your compiler's path then you need to set the environment
|
||||
variable <code class="computeroutput"><span class="identifier">ICU_PATH</span></code> to point
|
||||
to the root directory of your ICU installation, for example if ICU was installed
|
||||
to <code class="computeroutput"><span class="special">/</span><span class="identifier">usr</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">icu</span><span class="special">/</span><span class="number">3.3</span></code>
|
||||
you might use:
|
||||
</p>
|
||||
<pre class="programlisting">bjam -sICU_PATH=/usr/local/icu/3.3 --toolset=toolset-name install</pre>
|
||||
<p>
|
||||
Note that ICU is a C++ library just like Boost is, as such your copy of ICU
|
||||
must have been built with the same C++ compiler (and compiler version) that
|
||||
you are using to build Boost. Boost.Regex will not work correctly unless you
|
||||
ensure that this is the case: it is up to you to ensure that the version of
|
||||
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="id428763"></a>
|
||||
<a 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="id428787"></a>
|
||||
<a href="install.html#boost_regex.install.borland_c___builder_">Borland C++ Builder:</a>
|
||||
</h6>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Open up a console window and change to the <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>\</span><span class="identifier">libs</span><span class="special">\</span><span class="identifier">regex</span><span class="special">\</span><span class="identifier">build</span></code>
|
||||
directory.
|
||||
</li>
|
||||
<li>
|
||||
Select the appropriate makefile (bcb4.mak for C++ Builder 4, bcb5.mak for
|
||||
C++ Builder 5, and bcb6.mak for C++ Builder 6).
|
||||
</li>
|
||||
<li>
|
||||
Invoke the makefile (pass the full path to your version of make if you have
|
||||
more than one version installed, the makefile relies on the path to make
|
||||
to obtain your C++ Builder installation directory and tools) for example:
|
||||
</li>
|
||||
</ul></div>
|
||||
<pre class="programlisting">make -fbcb5.mak</pre>
|
||||
<p>
|
||||
The build process will build a variety of .lib and .dll files (the exact number
|
||||
depends upon the version of Borland's tools you are using) the .lib and dll
|
||||
files will be in a sub-directory called bcb4 or bcb5 depending upon the makefile
|
||||
used. To install the libraries into your development system use:
|
||||
</p>
|
||||
<pre class="programlisting">make -fbcb5.mak install</pre>
|
||||
<p>
|
||||
library files will be copied to <code class="computeroutput"><span class="special"><</span><span class="identifier">BCROOT</span><span class="special">>/</span><span class="identifier">lib</span></code> and the dll's to <code class="computeroutput"><span class="special"><</span><span class="identifier">BCROOT</span><span class="special">>/</span><span class="identifier">bin</span></code>, where <code class="computeroutput"><span class="special"><</span><span class="identifier">BCROOT</span><span class="special">></span></code>
|
||||
corresponds to the install path of your Borland C++ tools.
|
||||
</p>
|
||||
<p>
|
||||
You may also remove temporary files created during the build process (excluding
|
||||
lib and dll files) by using:
|
||||
</p>
|
||||
<pre class="programlisting">make -fbcb5.mak clean</pre>
|
||||
<p>
|
||||
Finally when you use Boost.Regex it is only necessary for you to add the <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">></span></code> root director to your list of include directories
|
||||
for that project. It is not necessary for you to manually add a .lib file to
|
||||
the project; the headers will automatically select the correct .lib file for
|
||||
your build mode and tell the linker to include it. There is one caveat however:
|
||||
the library can not tell the difference between VCL and non-VCL enabled builds
|
||||
when building a GUI application from the command line, if you build from the
|
||||
command line with the 5.5 command line tools then you must define the pre-processor
|
||||
symbol _NO_VCL in order to ensure that the correct link libraries are selected:
|
||||
the C++ Builder IDE normally sets this automatically. Hint, users of the 5.5
|
||||
command line tools may want to add a -D_NO_VCL to bcc32.cfg in order to set
|
||||
this option permanently.
|
||||
</p>
|
||||
<p>
|
||||
If you would prefer to do a dynamic link to the regex libraries when using
|
||||
the dll runtime then define BOOST_REGEX_DYN_LINK (you must do this if you want
|
||||
to use Boost.Regex in multiple dll's), otherwise Boost.Regex will be statically
|
||||
linked by default.
|
||||
</p>
|
||||
<p>
|
||||
If you want to suppress automatic linking altogether (and supply your own custom
|
||||
build of the lib) then define BOOST_REGEX_NO_LIB.
|
||||
</p>
|
||||
<p>
|
||||
If you are building with C++ Builder 6, you will find that <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">hpp</span><span class="special">></span></code>
|
||||
can not be used in a pre-compiled header (the actual problem is in <code class="computeroutput"><span class="special"><</span><span class="identifier">locale</span><span class="special">></span></code> which gets included by <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">hpp</span><span class="special">></span></code>),
|
||||
if this causes problems for you, then try defining BOOST_NO_STD_LOCALE when
|
||||
building, this will disable some features throughout boost, but may save you
|
||||
a lot in compile times!
|
||||
</p>
|
||||
<a name="boost_regex.install.microsoft_visual_c___6__7__7_1_and_8"></a><h5>
|
||||
<a name="id499563"></a>
|
||||
<a 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>
|
||||
<p>
|
||||
You need version 6 or later of MSVC to build this library. If you are using
|
||||
VC5 then you may want to look at one of the previous releases of this library.
|
||||
</p>
|
||||
<p>
|
||||
Open up a command prompt, which has the necessary MSVC environment variables
|
||||
defined (for example by using the batch file Vcvars32.bat installed by the
|
||||
Visual Studio installation), and change to the <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>\</span><span class="identifier">libs</span><span class="special">\</span><span class="identifier">regex</span><span class="special">\</span><span class="identifier">build</span> <span class="identifier">directory</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
Select the correct makefile - vc6.mak for "vanilla" Visual C++ 6
|
||||
or vc6-stlport.mak if you are using STLPort.
|
||||
</p>
|
||||
<p>
|
||||
Invoke the makefile like this:
|
||||
</p>
|
||||
<pre class="programlisting">nmake -fvc6.mak</pre>
|
||||
<p>
|
||||
You will now have a collection of lib and dll files in a "vc6" subdirectory,
|
||||
to install these into your development system use:
|
||||
</p>
|
||||
<pre class="programlisting">nmake -fvc6.mak install</pre>
|
||||
<p>
|
||||
The lib files will be copied to your <code class="computeroutput"><span class="special"><</span><span class="identifier">VC6</span><span class="special">>\</span><span class="identifier">lib</span></code> directory and the dll files to <code class="computeroutput"><span class="special"><</span><span class="identifier">VC6</span><span class="special">>\</span><span class="identifier">bin</span></code>, where <code class="computeroutput"><span class="special"><</span><span class="identifier">VC6</span><span class="special">></span></code> is
|
||||
the root of your Visual C++ 6 installation.
|
||||
</p>
|
||||
<p>
|
||||
You can delete all the temporary files created during the build (excluding
|
||||
lib and dll files) using:
|
||||
</p>
|
||||
<pre class="programlisting">nmake -fvc6.mak clean </pre>
|
||||
<p>
|
||||
If you want to build with ICU support, then you need to pass the path to your
|
||||
ICU directory to the makefile, for example with:
|
||||
</p>
|
||||
<pre class="programlisting">nmake ICU_PATH=c:\open-source\icu -fvc71.mak install</pre>
|
||||
<p>
|
||||
Finally when you use Boost.Regex it is only necessary for you to add the <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">></span></code> root directory to your list of include
|
||||
directories for that project. It is not necessary for you to manually add a
|
||||
.lib file to the project; the headers will automatically select the correct
|
||||
.lib file for your build mode and tell the linker to include it.
|
||||
</p>
|
||||
<p>
|
||||
Note that if you want to dynamically link to the regex library when using the
|
||||
dynamic C++ runtime, define BOOST_REGEX_DYN_LINK when building your project.
|
||||
</p>
|
||||
<p>
|
||||
If you want to add the source directly to your project then define BOOST_REGEX_NO_LIB
|
||||
to disable automatic library selection.
|
||||
</p>
|
||||
<p>
|
||||
There are several important caveats to remember when using Boost.Regex with
|
||||
Microsoft's Compiler:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
There have been some reports of compiler-optimization bugs affecting this
|
||||
library, (particularly with VC6 versions prior to service patch 5) the workaround
|
||||
is to build the library using /Oityb1 rather than /O2. That is to use all
|
||||
optimization settings except /Oa. This problem is reported to affect some
|
||||
standard library code as well ( in fact I'm not sure if the problem is with
|
||||
the regex code or the underlying standard library), so it's probably worthwhile
|
||||
applying this workaround in normal practice in any case.
|
||||
</li>
|
||||
<li>
|
||||
If you have replaced the C++ standard library that comes with VC6, then when
|
||||
you build the library you must ensure that the environment variables "INCLUDE"
|
||||
and "LIB" have been updated to reflect the include and library
|
||||
paths for the new library - see vcvars32.bat (part of your Visual Studio
|
||||
installation) for more details.
|
||||
</li>
|
||||
<li>
|
||||
If you are building with the full STLPort v4.x, then use the vc6-stlport.mak
|
||||
file provided and set the environment variable STLPORT_PATH to point to the
|
||||
location of your STLPort installation (Note that the full STLPort libraries
|
||||
appear not to support single-thread static builds).
|
||||
</li>
|
||||
<li>
|
||||
If you are building your application with /Zc:wchar_t then you will need
|
||||
to modify the makefile to add /Zc:wchar_t before building the library.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.install.gcc_2_95_and_later_"></a><h6>
|
||||
<a name="id499884"></a>
|
||||
<a href="install.html#boost_regex.install.gcc_2_95_and_later_">GCC(2.95 and later)</a>
|
||||
</h6>
|
||||
<p>
|
||||
You can build with gcc using the normal boost Jamfile in <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">build</span></code>, alternatively
|
||||
there is a conservative makefile for the g++ compiler. From the command prompt
|
||||
change to the <boost>/libs/regex/build directory and type:
|
||||
</p>
|
||||
<pre class="programlisting">make -fgcc.mak </pre>
|
||||
<p>
|
||||
At the end of the build process you should have a gcc sub-directory containing
|
||||
release and debug versions of the library (libboost_regex.a and libboost_regex_debug.a).
|
||||
When you build projects that use regex++, you will need to add the boost install
|
||||
directory to your list of include paths and add <boost>/libs/regex/build/gcc/libboost_regex.a
|
||||
to your list of library files.
|
||||
</p>
|
||||
<p>
|
||||
There is also a makefile to build the library as a shared library:
|
||||
</p>
|
||||
<pre class="programlisting">make -fgcc-shared.mak</pre>
|
||||
<p>
|
||||
which will build libboost_regex.so and libboost_regex_debug.so.
|
||||
</p>
|
||||
<p>
|
||||
Both of the these makefiles support the following environment variables:
|
||||
</p>
|
||||
<p>
|
||||
ICU_PATH: tells the makefile to build with Unicode support, set to the path
|
||||
where your ICU installation is located, for example with: make ICU_PATH=/usr/local
|
||||
install -fgcc.mak
|
||||
</p>
|
||||
<p>
|
||||
CXXFLAGS: extra compiler options - note that this applies to both the debug
|
||||
and release builds.
|
||||
</p>
|
||||
<p>
|
||||
INCLUDES: additional include directories.
|
||||
</p>
|
||||
<p>
|
||||
LDFLAGS: additional linker options.
|
||||
</p>
|
||||
<p>
|
||||
LIBS: additional library files.
|
||||
</p>
|
||||
<p>
|
||||
For the more adventurous there is a configure script in <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">config</span></code>;
|
||||
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="id500082"></a>
|
||||
<a href="install.html#boost_regex.install.sun_workshop_6_1">Sun Workshop 6.1</a>
|
||||
</h6>
|
||||
<p>
|
||||
There is a makefile for the sun (6.1) compiler (C++ version 3.12). From the
|
||||
command prompt change to the <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">build</span></code> directory
|
||||
and type:
|
||||
</p>
|
||||
<pre class="programlisting">dmake -f sunpro.mak </pre>
|
||||
<p>
|
||||
At the end of the build process you should have a sunpro sub-directory containing
|
||||
single and multithread versions of the library (libboost_regex.a, libboost_regex.so,
|
||||
libboost_regex_mt.a and libboost_regex_mt.so). When you build projects that
|
||||
use Boost.Regex, you will need to add the boost install directory to your list
|
||||
of include paths and add <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">>/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">build</span><span class="special">/</span><span class="identifier">sunpro</span><span class="special">/</span></code> to
|
||||
your library search path.
|
||||
</p>
|
||||
<p>
|
||||
Both of the these makefiles support the following environment variables:
|
||||
</p>
|
||||
<p>
|
||||
CXXFLAGS: extra compiler options - note that this applies to both the single
|
||||
and multithreaded builds.
|
||||
</p>
|
||||
<p>
|
||||
INCLUDES: additional include directories.
|
||||
</p>
|
||||
<p>
|
||||
LDFLAGS: additional linker options.
|
||||
</p>
|
||||
<p>
|
||||
LIBS: additional library files.
|
||||
</p>
|
||||
<p>
|
||||
LIBSUFFIX: a suffix to mangle the library name with (defaults to nothing).
|
||||
</p>
|
||||
<p>
|
||||
This makefile does not set any architecture specific options like -xarch=v9,
|
||||
you can set these by defining the appropriate macros, for example:
|
||||
</p>
|
||||
<pre class="programlisting">dmake CXXFLAGS="-xarch<code class="literal">v9" LDFLAGS</code>"-xarch<code class="literal">v9" LIBSUFFIX</code>"_v9" -f sunpro.mak</pre>
|
||||
<p>
|
||||
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="id500302"></a>
|
||||
<a href="install.html#boost_regex.install.makefiles_for_other_compilers">Makefiles
|
||||
for Other compilers</a>
|
||||
</h6>
|
||||
<p>
|
||||
There is a generic makefile (generic.mak ) provided in <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">-</span><span class="identifier">root</span><span class="special">>/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">build</span></code> - see that makefile for details of
|
||||
environment variables that need to be set before use.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="configuration/tuning.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="introduction_and_overview.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,214 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Introduction and Overview</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="install.html" title="Building and Installing the Library">
|
||||
<link rel="next" href="unicode.html" title="Unicode and Boost.Regex">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="install.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.introduction_and_overview"></a><a href="introduction_and_overview.html" title="Introduction and Overview">Introduction and
|
||||
Overview</a></h2></div></div></div>
|
||||
<p>
|
||||
Regular expressions are a form of pattern-matching that are often used in text
|
||||
processing; many users will be familiar with the Unix utilities grep, sed and
|
||||
awk, and the programming language Perl, each of which make extensive use of
|
||||
regular expressions. Traditionally C++ users have been limited to the POSIX
|
||||
C API's for manipulating regular expressions, and while Boost.Regex does provide
|
||||
these API's, they do not represent the best way to use the library. For example
|
||||
Boost.Regex can cope with wide character strings, or search and replace operations
|
||||
(in a manner analogous to either sed or Perl), something that traditional C
|
||||
libraries can not do.
|
||||
</p>
|
||||
<p>
|
||||
The class <a href="ref/basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>
|
||||
is the key class in this library; it represents a "machine readable"
|
||||
regular expression, and is very closely modeled on <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code>,
|
||||
think of it as a string plus the actual state-machine required by the regular
|
||||
expression algorithms. Like <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code>
|
||||
there are two typedefs that are almost always the means by which this class
|
||||
is referenced:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</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="identifier">regex_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">basic_regex</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="identifier">regex</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="keyword">wchar_t</span><span class="special">></span> <span class="identifier">wregex</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
To see how this library can be used, imagine that we are writing a credit card
|
||||
processing application. Credit card numbers generally come as a string of 16-digits,
|
||||
separated into groups of 4-digits, and separated by either a space or a hyphen.
|
||||
Before storing a credit card number in a database (not necessarily something
|
||||
your customers will appreciate!), we may want to verify that the number is
|
||||
in the correct format. To match any digit we could use the regular expression
|
||||
[0-9], however ranges of characters like this are actually locale dependent.
|
||||
Instead we should use the POSIX standard form [[:digit:]], or the Boost.Regex
|
||||
and Perl shorthand for this \d (note that many older libraries tended to be
|
||||
hard-coded to the C-locale, consequently this was not an issue for them). That
|
||||
leaves us with the following regular expression to validate credit card number
|
||||
formats:
|
||||
</p>
|
||||
<pre class="programlisting">(\d{4}<span class="strikethrough"></span>){3}\d{4}</pre>
|
||||
<p>
|
||||
Here the parenthesis act to group (and mark for future reference) sub-expressions,
|
||||
and the {4} means "repeat exactly 4 times". This is an example of
|
||||
the extended regular expression syntax used by Perl, awk and egrep. Boost.Regex
|
||||
also supports the older "basic" syntax used by sed and grep, but
|
||||
this is generally less useful, unless you already have some basic regular expressions
|
||||
that you need to reuse.
|
||||
</p>
|
||||
<p>
|
||||
Now let's take that expression and place it in some C++ code to validate the
|
||||
format of a credit card number:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="identifier">validate_card_format</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="special">{</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"(\\d{4}[- ]){3}\\d{4}"</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Note how we had to add some extra escapes to the expression: remember that
|
||||
the escape is seen once by the C++ compiler, before it gets to be seen by the
|
||||
regular expression engine, consequently escapes in regular expressions have
|
||||
to be doubled up when embedding them in C/C++ code. Also note that all the
|
||||
examples assume that your compiler supports argument-dependent-lookup lookup,
|
||||
if yours doesn't (for example VC6), then you will have to add some <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span></code> prefixes
|
||||
to some of the function calls in the examples.
|
||||
</p>
|
||||
<p>
|
||||
Those of you who are familiar with credit card processing, will have realized
|
||||
that while the format used above is suitable for human readable card numbers,
|
||||
it does not represent the format required by online credit card systems; these
|
||||
require the number as a string of 16 (or possibly 15) digits, without any intervening
|
||||
spaces. What we need is a means to convert easily between the two formats,
|
||||
and this is where search and replace comes in. Those who are familiar with
|
||||
the utilities sed and Perl will already be ahead here; we need two strings
|
||||
- one a regular expression - the other a "format string" that provides
|
||||
a description of the text to replace the match with. In Boost.Regex this search
|
||||
and replace operation is performed with the algorithm <a href="ref/regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a>, for our credit card
|
||||
example we can write two algorithms like this to provide the format conversions:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">// match any format with the regular expression:
|
||||
</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"</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="identifier">machine_format</span><span class="special">(</span><span class="string">"\\1\\2\\3\\4"</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="identifier">human_format</span><span class="special">(</span><span class="string">"\\1-\\2-\\3-\\4"</span><span class="special">);</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">machine_readable_card_number</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="identifier">s</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">machine_format</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">format_sed</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">human_readable_card_number</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="identifier">s</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">human_format</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">format_sed</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Here we've used marked sub-expressions in the regular expression to split out
|
||||
the four parts of the card number as separate fields, the format string then
|
||||
uses the sed-like syntax to replace the matched text with the reformatted version.
|
||||
</p>
|
||||
<p>
|
||||
In the examples above, we haven't directly manipulated the results of a regular
|
||||
expression match, however in general the result of a match contains a number
|
||||
of sub-expression matches in addition to the overall match. When the library
|
||||
needs to report a regular expression match it does so using an instance of
|
||||
the class <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>,
|
||||
as before there are typedefs of this class for the most common cases:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">cmatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span> <span class="identifier">wcmatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">smatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">wsmatch</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The algorithms <a href="ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>
|
||||
and <a href="ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>
|
||||
make use of <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>
|
||||
to report what matched; the difference between these algorithms is that <a href="ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>
|
||||
will only find matches that consume <span class="emphasis"><em>all</em></span> of the input text,
|
||||
where as <a href="ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>
|
||||
will search for a match anywhere within the text being matched.
|
||||
</p>
|
||||
<p>
|
||||
Note that these algorithms are not restricted to searching regular C-strings,
|
||||
any bidirectional iterator type can be searched, allowing for the possibility
|
||||
of seamlessly searching almost any kind of data.
|
||||
</p>
|
||||
<p>
|
||||
For search and replace operations, in addition to the algorithm <a href="ref/regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a> that we have already
|
||||
seen, the <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>
|
||||
class has a <code class="computeroutput"><span class="identifier">format</span></code> member that
|
||||
takes the result of a match and a format string, and produces a new string
|
||||
by merging the two.
|
||||
</p>
|
||||
<p>
|
||||
For iterating through all occurences of an expression within a text, there
|
||||
are two iterator types: <a href="ref/regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> will enumerate over
|
||||
the <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>
|
||||
objects found, while <a href="ref/regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> will enumerate
|
||||
a series of strings (similar to perl style split operations).
|
||||
</p>
|
||||
<p>
|
||||
For those that dislike templates, there is a high level wrapper class <a href="ref/deprecated_interfaces/old_regex.html" title="High Level Class RegEx (Deprecated)"><code class="computeroutput"><span class="identifier">RegEx</span></code></a>
|
||||
that is an encapsulation of the lower level template code - it provides a simplified
|
||||
interface for those that don't need the full power of the library, and supports
|
||||
only narrow characters, and the "extended" regular expression syntax.
|
||||
This class is now deprecated as it does not form part of the regular expressions
|
||||
C++ standard library proposal.
|
||||
</p>
|
||||
<p>
|
||||
The POSIX API functions: <a href="ref/posix.html#boost_regex.ref.posix.regcomp"><code class="computeroutput"><span class="identifier">regcomp</span></code></a>, <a href="ref/posix.html#boost_regex.ref.posix.regexec"><code class="computeroutput"><span class="identifier">regexec</span></code></a>, <a href="ref/posix.html#boost_regex.ref.posix.regfree"><code class="computeroutput"><span class="identifier">regfree</span></code></a> and [regerr], are available
|
||||
in both narrow character and Unicode versions, and are provided for those who
|
||||
need compatibility with these API's.
|
||||
</p>
|
||||
<p>
|
||||
Finally, note that the library now has <a href="background_information/locale.html" title="Localization">run-time
|
||||
localization support</a>, and recognizes the full POSIX regular expression
|
||||
syntax - including advanced features like multi-character collating elements
|
||||
and equivalence classes - as well as providing compatibility with other regular
|
||||
expression libraries including GNU and BSD4 regex packages, PCRE and Perl 5.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="install.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,304 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Partial Matches</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="captures.html" title="Understanding Marked Sub-Expressions and Captures">
|
||||
<link rel="next" href="syntax.html" title="Regular Expression Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="captures.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.partial_matches"></a><a href="partial_matches.html" title="Partial Matches"> Partial Matches</a></h2></div></div></div>
|
||||
<p>
|
||||
The <a href="ref/match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>
|
||||
<code class="computeroutput"><span class="identifier">match_partial</span></code> can be passed
|
||||
to the following algorithms: <a href="ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>, <a href="ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, and <a href="ref/deprecated_interfaces/regex_grep.html" title="regex_grep (Deprecated)"><code class="computeroutput"><span class="identifier">regex_grep</span></code></a>, and used with the iterator
|
||||
<a href="ref/regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>.
|
||||
When used it indicates that partial as well as full matches should be found.
|
||||
A partial match is one that matched one or more characters at the end of the
|
||||
text input, but did not match all of the regular expression (although it may
|
||||
have done so had more input been available). Partial matches are typically
|
||||
used when either validating data input (checking each character as it is entered
|
||||
on the keyboard), or when searching texts that are either too long to load
|
||||
into memory (or even into a memory mapped file), or are of indeterminate length
|
||||
(for example the source may be a socket or similar). Partial and full matches
|
||||
can be differentiated as shown in the following table (the variable M represents
|
||||
an instance of <a href="ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> as filled in by <a href="ref/regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>,
|
||||
<a href="ref/regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>
|
||||
or <a href="ref/deprecated_interfaces/regex_grep.html" title="regex_grep (Deprecated)"><code class="computeroutput"><span class="identifier">regex_grep</span></code></a>):
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Result
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
M[0].matched
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
M[0].first
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
M[0].second
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
No match
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
False
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Undefined
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Undefined
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Undefined
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Partial match
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
True
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
False
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Start of partial match.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
End of partial match (end of text).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Full match
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
True
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
True
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Start of full match.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
End of full match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Be aware that using partial matches can sometimes result in somewhat imperfect
|
||||
behavior:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
There are some expressions, such as ".*abc" that will always produce
|
||||
a partial match. This problem can be reduced by careful construction of the
|
||||
regular expressions used, or by setting flags like match_not_dot_newline
|
||||
so that expressions like .* can't match past line boundaries.
|
||||
</li>
|
||||
<li>
|
||||
Boost.Regex currently prefers leftmost matches to full matches, so for example
|
||||
matching "abc|b" against "ab" produces a partial match
|
||||
against the "ab" rather than a full match against "b".
|
||||
It's more efficient to work this way, but may not be the behavior you want
|
||||
in all situations.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The following example tests to see whether the text could be a valid credit
|
||||
card number, as the user presses a key, the character entered would be added
|
||||
to the string being built up, and passed to <code class="computeroutput"><span class="identifier">is_possible_card_number</span></code>.
|
||||
If this returns true then the text could be a valid card number, so the user
|
||||
interface's OK button would be enabled. If it returns false, then this is not
|
||||
yet a valid card number, but could be with more input, so the user interface
|
||||
would disable the OK button. Finally, if the procedure throws an exception
|
||||
the input could never become a valid number, and the inputted character must
|
||||
be discarded, and a suitable error indication displayed to the user.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})"</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">bool</span> <span class="identifier">is_possible_card_number</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">input</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// return false for partial match, true for full match, or throw for
|
||||
</span> <span class="comment">// impossible match based on what we have so far...
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="number">0</span> <span class="special">==</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">input</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_partial</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// the input so far could not possibly be valid so reject it:
|
||||
</span> <span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">(</span>
|
||||
<span class="string">"Invalid data entered - this could not possibly be a valid card number"</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">// OK so far so good, but have we finished?
|
||||
</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// excellent, we have a result:
|
||||
</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">// what we have so far is only a partial match...
|
||||
</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
In the following example, text input is taken from a stream containing an unknown
|
||||
amount of text; this example simply counts the number of html tags encountered
|
||||
in the stream. The text is loaded into a buffer and searched a part at a time,
|
||||
if a partial match was encountered, then the partial match gets searched a
|
||||
second time as the start of the next batch of text:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">sstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="comment">// match some kind of html tag:
|
||||
</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"<[^>]*>"</span><span class="special">);</span>
|
||||
<span class="comment">// count how many:
|
||||
</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">tags</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">search</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// buffer we'll be searching in:
|
||||
</span> <span class="keyword">char</span> <span class="identifier">buf</span><span class="special">[</span><span class="number">4096</span><span class="special">];</span>
|
||||
<span class="comment">// saved position of end of partial match:
|
||||
</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">next_pos</span> <span class="special">=</span> <span class="identifier">buf</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">buf</span><span class="special">);</span>
|
||||
<span class="comment">// flag to indicate whether there is more input to come:
|
||||
</span> <span class="keyword">bool</span> <span class="identifier">have_more</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">have_more</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// how much do we copy forward from last try:
|
||||
</span> <span class="keyword">unsigned</span> <span class="identifier">leftover</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">buf</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">buf</span><span class="special">))</span> <span class="special">-</span> <span class="identifier">next_pos</span><span class="special">;</span>
|
||||
<span class="comment">// and how much is left to fill:
|
||||
</span> <span class="keyword">unsigned</span> <span class="identifier">size</span> <span class="special">=</span> <span class="identifier">next_pos</span> <span class="special">-</span> <span class="identifier">buf</span><span class="special">;</span>
|
||||
<span class="comment">// copy forward whatever we have left:
|
||||
</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">memmove</span><span class="special">(</span><span class="identifier">buf</span><span class="special">,</span> <span class="identifier">next_pos</span><span class="special">,</span> <span class="identifier">leftover</span><span class="special">);</span>
|
||||
<span class="comment">// fill the rest from the stream:
|
||||
</span> <span class="identifier">is</span><span class="special">.</span><span class="identifier">read</span><span class="special">(</span><span class="identifier">buf</span> <span class="special">+</span> <span class="identifier">leftover</span><span class="special">,</span> <span class="identifier">size</span><span class="special">);</span>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">read</span> <span class="special">=</span> <span class="identifier">is</span><span class="special">.</span><span class="identifier">gcount</span><span class="special">();</span>
|
||||
<span class="comment">// check to see if we've run out of text:
|
||||
</span> <span class="identifier">have_more</span> <span class="special">=</span> <span class="identifier">read</span> <span class="special">==</span> <span class="identifier">size</span><span class="special">;</span>
|
||||
<span class="comment">// reset next_pos:
|
||||
</span> <span class="identifier">next_pos</span> <span class="special">=</span> <span class="identifier">buf</span> <span class="special">+</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">buf</span><span class="special">);</span>
|
||||
<span class="comment">// and then iterate:
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">cregex_iterator</span> <span class="identifier">a</span><span class="special">(</span>
|
||||
<span class="identifier">buf</span><span class="special">,</span>
|
||||
<span class="identifier">buf</span> <span class="special">+</span> <span class="identifier">read</span> <span class="special">+</span> <span class="identifier">leftover</span><span class="special">,</span>
|
||||
<span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_partial</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">cregex_iterator</span> <span class="identifier">b</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">a</span> <span class="special">!=</span> <span class="identifier">b</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span><span class="special">((*</span><span class="identifier">a</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// Partial match, save position and break:
|
||||
</span> <span class="identifier">next_pos</span> <span class="special">=</span> <span class="special">(*</span><span class="identifier">a</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span><span class="special">;</span>
|
||||
<span class="keyword">break</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// full match:
|
||||
</span> <span class="special">++</span><span class="identifier">tags</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="comment">// move to next match:
|
||||
</span> <span class="special">++</span><span class="identifier">a</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="captures.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,139 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="format/boost_format_syntax.html" title="Boost-Extended Format String Syntax">
|
||||
<link rel="next" href="ref/basic_regex.html" title="basic_regex">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="format/boost_format_syntax.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ref/basic_regex.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.ref"></a><a href="ref.html" title="Reference"> Reference</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="ref/basic_regex.html"> basic_regex</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/match_results.html"> match_results</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/sub_match.html"> sub_match</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_match.html"> regex_match</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_search.html"> regex_search</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_replace.html"> regex_replace</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_iterator.html"> regex_iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_token_iterator.html"> regex_token_iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/bad_expression.html"> bad_expression</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type.html"> syntax_option_type</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_synopsis.html">
|
||||
syntax_option_type Synopsis</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_overview.html">
|
||||
Overview of syntax_option_type</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_perl.html">
|
||||
Options for Perl Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_extended.html">
|
||||
Options for POSIX Extended Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_basic.html">
|
||||
Options for POSIX Basic Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/syntax_option_type/syntax_option_type_literal.html">
|
||||
Options for Literal Strings</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="ref/match_flag_type.html"> match_flag_type</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/error_type.html"> error_type</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/regex_traits.html"> regex_traits</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings.html"> Interfacing With Non-Standard
|
||||
String Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/icu.html"> Working With
|
||||
Unicode and ICU String Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/icu/intro.html"> Introduction
|
||||
to using Regex with ICU</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/icu/unicode_types.html">
|
||||
Unicode regular expression types</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/icu/unicode_algo.html">
|
||||
Unicode Regular Expression Algorithms</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/icu/unicode_iter.html">
|
||||
Unicode Aware Regex Iterators</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings.html"> Using
|
||||
Boost Regex With MFC Strings</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings/mfc_intro.html">
|
||||
Introduction to Boost.Regex and MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings/mfc_regex_types.html">
|
||||
Regex Types Used With MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings/mfc_regex_create.html">
|
||||
Regular Expression Creation From an MFC String</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings/mfc_algo.html">
|
||||
Overloaded Algorithms For MFC String Types</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/non_std_strings/mfc_strings/mfc_iter.html">
|
||||
Iterating Over the Matches Within An MFC String</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="ref/posix.html"> POSIX Compatible C API's</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/concepts.html"> Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/concepts/charT_concept.html"> charT Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/concepts/traits_concept.html"> Traits Class
|
||||
Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/concepts/iterator_concepts.html"> Iterator
|
||||
Rrequirements</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="ref/deprecated_interfaces.html">Deprecated Interfaces</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="ref/deprecated_interfaces/regex_format.html">
|
||||
regex_format (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/deprecated_interfaces/regex_grep.html">
|
||||
regex_grep (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/deprecated_interfaces/regex_split.html">
|
||||
regex_split (deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="ref/deprecated_interfaces/old_regex.html"> High
|
||||
Level Class RegEx (Deprecated)</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="format/boost_format_syntax.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ref/basic_regex.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,103 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>bad_expression</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_token_iterator.html" title="regex_token_iterator">
|
||||
<link rel="next" href="syntax_option_type.html" title="syntax_option_type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_token_iterator.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.bad_expression"></a><a 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="id606327"></a>
|
||||
<a 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>
|
||||
</pre>
|
||||
<p>
|
||||
The class <code class="computeroutput"><span class="identifier">regex_error</span></code> defines
|
||||
the type of objects thrown as exceptions to report errors during the conversion
|
||||
from a string representing a regular expression to a finite state machine.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">class</span> <span class="identifier">regex_error</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">explicit</span> <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>
|
||||
<span class="keyword">explicit</span> <span class="identifier">regex_error</span><span class="special">(</span><span class="identifier">boost</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">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">code</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">position</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_error</span> <span class="identifier">bad_pattern</span><span class="special">;</span> <span class="comment">// for backwards compatibility
|
||||
</span><span class="keyword">typedef</span> <span class="identifier">regex_error</span> <span class="identifier">bad_expression</span><span class="special">;</span> <span class="comment">// for backwards compatibility
|
||||
</span>
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.bad_expression.description"></a><h5>
|
||||
<a name="id606834"></a>
|
||||
<a 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>
|
||||
<span class="identifier">regex_error</span><span class="special">(</span><span class="identifier">boost</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>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects:</strong></span> Constructs an object of class regex_error.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">code</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 error code that represents
|
||||
parsing error that occurred.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">position</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 location in the expression
|
||||
where parsing stopped.
|
||||
</p>
|
||||
<p>
|
||||
Footnotes: the choice of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
as the base class for <code class="computeroutput"><span class="identifier">regex_error</span></code>
|
||||
is moot; depending upon how the library is used exceptions may be either
|
||||
logic errors (programmer supplied expressions) or run time errors (user supplied
|
||||
expressions). The library previously used <code class="computeroutput"><span class="identifier">bad_pattern</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">bad_expression</span></code> for errors,
|
||||
these have been replaced by the single class <code class="computeroutput"><span class="identifier">regex_error</span></code>
|
||||
to keep the library in synchronization with the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Technical
|
||||
report on C++ Library Extensions</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_token_iterator.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Concepts</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="posix.html" title="POSIX Compatible C API's">
|
||||
<link rel="next" href="concepts/charT_concept.html" title="charT Requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="concepts/charT_concept.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.concepts"></a><a href="concepts.html" title="Concepts"> Concepts</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="concepts/charT_concept.html"> charT Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="concepts/traits_concept.html"> Traits Class
|
||||
Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="concepts/iterator_concepts.html"> Iterator
|
||||
Rrequirements</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="concepts/charT_concept.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,267 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>charT Requirements</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../concepts.html" title="Concepts">
|
||||
<link rel="prev" href="../concepts.html" title="Concepts">
|
||||
<link rel="next" href="traits_concept.html" title="Traits Class Requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../concepts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="traits_concept.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.concepts.charT_concept"></a><a href="charT_concept.html" title="charT Requirements"> charT Requirements</a></h4></div></div></div>
|
||||
<p>
|
||||
Type <code class="computeroutput"><span class="identifier">charT</span></code> used a template
|
||||
argument to class template <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>, must have a trivial
|
||||
default constructor, copy constructor, assignment operator, and destructor.
|
||||
In addition the following requirements must be met for objects; <span class="emphasis"><em>c</em></span>
|
||||
of type <code class="computeroutput"><span class="identifier">charT</span></code>, <span class="emphasis"><em>c1</em></span>
|
||||
and <span class="emphasis"><em>c2</em></span> of type <code class="computeroutput"><span class="identifier">charT</span>
|
||||
<span class="keyword">const</span></code>, and <span class="emphasis"><em>i</em></span>
|
||||
of type <code class="computeroutput"><span class="keyword">int</span></code>:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Assertion / Note / Pre- / Post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
charT c
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default constructor (must be trivial).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
charT c(c1)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Copy constructor (must be trivial).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 = c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assignment operator (must be trivial).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 == c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if c1 has the same value as c2.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 != c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if c1 and c2 are not equal.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 < c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if the value of c1 is less than c2.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 > c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if the value of c1 is greater than c2.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 <= c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if c1 is less than or equal to c2.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
c1 >= c2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if c1 is greater than or equal to c2.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
intmax_t i = c1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
int
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT must be convertible to an integral type.
|
||||
</p>
|
||||
<p>
|
||||
Note: type charT is not required to support this operation, if
|
||||
the traits class used supports the full Boost-specific interface,
|
||||
rather than the minimal standardised-interface (see traits class
|
||||
requirements below).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
charT c(i);
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT must be constructable from an integral type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../concepts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="traits_concept.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,42 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Iterator Rrequirements</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../concepts.html" title="Concepts">
|
||||
<link rel="prev" href="traits_concept.html" title="Traits Class Requirements">
|
||||
<link rel="next" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="traits_concept.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.concepts.iterator_concepts"></a><a href="iterator_concepts.html" title="Iterator Rrequirements"> Iterator
|
||||
Rrequirements</a></h4></div></div></div>
|
||||
<p>
|
||||
The regular expression algorithms (and iterators) take all require a Bidirectional-Iterator.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="traits_concept.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,608 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Traits Class Requirements</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../concepts.html" title="Concepts">
|
||||
<link rel="prev" href="charT_concept.html" title="charT Requirements">
|
||||
<link rel="next" href="iterator_concepts.html" title="Iterator Rrequirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="charT_concept.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_concepts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.concepts.traits_concept"></a><a href="traits_concept.html" title="Traits Class Requirements"> Traits Class
|
||||
Requirements</a></h4></div></div></div>
|
||||
<p>
|
||||
There are two sets of requirements for the <code class="computeroutput"><span class="identifier">traits</span></code>
|
||||
template argument to <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>: a mininal interface
|
||||
(which is part of the regex standardization proposal), and an optional
|
||||
Boost-specific enhanced interface.
|
||||
</p>
|
||||
<a name="boost_regex.ref.concepts.traits_concept.minimal_requirements_"></a><h5>
|
||||
<a name="id632985"></a>
|
||||
<a href="traits_concept.html#boost_regex.ref.concepts.traits_concept.minimal_requirements_">Minimal
|
||||
requirements.</a>
|
||||
</h5>
|
||||
<p>
|
||||
In the following table <code class="computeroutput"><span class="identifier">X</span></code>
|
||||
denotes a traits class defining types and functions for the character container
|
||||
type <code class="computeroutput"><span class="identifier">charT</span></code>; <span class="emphasis"><em>u</em></span>
|
||||
is an object of type <code class="computeroutput"><span class="identifier">X</span></code>;
|
||||
<span class="emphasis"><em>v</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="identifier">X</span></code>; <span class="emphasis"><em>p</em></span> is
|
||||
a value of type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span></code>; <span class="emphasis"><em>I1</em></span> and <span class="emphasis"><em>I2</em></span>
|
||||
are Input Iterators; <span class="emphasis"><em>c</em></span> is a value of type <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span></code>;
|
||||
<span class="emphasis"><em>s</em></span> is an object of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">string_type</span></code>;
|
||||
<span class="emphasis"><em>cs</em></span> is an object of type <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="identifier">X</span><span class="special">::</span><span class="identifier">string_type</span></code>; <span class="emphasis"><em>b</em></span> is
|
||||
a value of type <code class="computeroutput"><span class="keyword">bool</span></code>; <span class="emphasis"><em>I</em></span>
|
||||
is a value of type <code class="computeroutput"><span class="keyword">int</span></code>; <span class="emphasis"><em>F1</em></span>
|
||||
and <span class="emphasis"><em>F2</em></span> are values of type <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="identifier">charT</span><span class="special">*</span></code>;
|
||||
and <span class="emphasis"><em>loc</em></span> is an object of type <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">locale_type</span></code>.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Assertion / Note Pre / Post condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
charT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The character container type used in the implementation of class
|
||||
template basic_regex.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::size_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An unsigned integer type, capable of holding the length of a null-terminated
|
||||
string of charT's.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::string_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
std::basic_string<charT> or std::vector<charT>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::locale_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Implementation defined
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A copy constructible type that represents the locale used by the
|
||||
traits class.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::char_class_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Implementation defined
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A bitmask type representing a particular character classification.
|
||||
Multiple values of this type can be bitwise-or'ed together to obtain
|
||||
a new valid value.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::length(p)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::size_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yields the smallest i such that p[i] == 0. Complexity is linear
|
||||
in i.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.translate(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a character such that for any character d that is to be
|
||||
considered equivalent to c then v.translate(c) == v.translate(d).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.translate_nocase(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all characters C that are to be considered equivalent to c
|
||||
when comparisons are to be performed without regard to case, then
|
||||
v.translate_nocase(c) == v.translate_nocase(C).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.transform(F1, F2)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::string_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a sort key for the character sequence designated by the
|
||||
iterator range [F1, F2) such that if the character sequence [G1,
|
||||
G2) sorts before the character sequence [H1, H2) then v.transform(G1,
|
||||
G2) < v.transform(H1, H2).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.transform_primary(F1, F2)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::string_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a sort key for the character sequence designated by the
|
||||
iterator range [F1, F2) such that if the character sequence [G1,
|
||||
G2) sorts before the character sequence [H1, H2) when character
|
||||
case is not considered then v.transform_primary(G1, G2) < v.transform_primary(H1,
|
||||
H2).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.lookup_classname(F1, F2)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_class_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Converts the character sequence designated by the iterator range
|
||||
[F1,F2) into a bitmask type that can subsequently be passed to
|
||||
isctype. Values returned from lookup_classname can be safely bitwise
|
||||
or'ed together. Returns 0 if the character sequence is not the
|
||||
name of a character class recognized by X. The value returned shall
|
||||
be independent of the case of the characters in the sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.lookup_collatename(F1, F2)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::string_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a sequence of characters that represents the collating
|
||||
element consisting of the character sequence designated by the
|
||||
iterator range [F1, F2). Returns an empty string if the character
|
||||
sequence is not a valid collating element.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.isctype(c, v.lookup_classname (F1, F2))
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
bool
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns true if character c is a member of the character class
|
||||
designated by the iterator range [F1, F2), false otherwise.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.value(c, i)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
int
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the value represented by the digit c in base I if the character
|
||||
c is a valid digit in base I; otherwise returns -1. [Note: the
|
||||
value of I will only be 8, 10, or 16. -end note]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
u.imbue(loc)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::locale_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Imbues u with the locale loc, returns the previous locale used
|
||||
by u if any.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.getloc()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::locale_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the current locale used by v if any.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.error_string(i)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
std::string
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a human readable error string for the error condition i,
|
||||
where i is one of the values enumerated by type regex_constants::error_type.
|
||||
If the value i is not recognized then returns the string "Unknown
|
||||
error" or a localized equivalent.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.ref.concepts.traits_concept.additional_optional_requirements"></a><h5>
|
||||
<a name="id633828"></a>
|
||||
<a href="traits_concept.html#boost_regex.ref.concepts.traits_concept.additional_optional_requirements">Additional
|
||||
Optional Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following additional requirements are strictly optional, however in
|
||||
order for <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>
|
||||
to take advantage of these additional interfaces, all of the following
|
||||
requirements must be met; <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> will detect the presence
|
||||
or absense of the member <code class="computeroutput"><span class="identifier">boost_extensions_tag</span></code>
|
||||
and configure itself appropriately.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Result
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Assertion / Note Pre / Post condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
X::boost_extensions_tag
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An unspecified type.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When present, all of the extensions listed in this table must be
|
||||
present.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.syntax_type(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
regex_constants::syntax_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a symbolic value of type regex_constants::syntax_type that
|
||||
signifies the meaning of character c within the regular expression
|
||||
grammar.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.escape_syntax_type(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
regex_constants::escape_syntax_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a symbolic value of type regex_constants::escape_syntax_type,
|
||||
that signifies the meaning of character c within the regular expression
|
||||
grammar, when c has been preceded by an escape character. Precondition:
|
||||
if b is the character preceding c in the expression being parsed
|
||||
then: <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">syntax_type</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
|
||||
<span class="special">==</span> <span class="identifier">syntax_escape</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.translate(c, b)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a character d such that: for any character d that is to
|
||||
be considered equivalent to c then <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span><span class="keyword">false</span><span class="special">)==</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">d</span><span class="special">,</span><span class="keyword">false</span><span class="special">)</span></code>. Likewise for all characters C
|
||||
that are to be considered equivalent to c when comparisons are
|
||||
to be performed without regard to case, then <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span><span class="keyword">true</span><span class="special">)==</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">translate</span><span class="special">(</span><span class="identifier">C</span><span class="special">,</span><span class="keyword">true</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.toi(I1, I2, i)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An integer type capable of holding either a charT or an int.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Behaves as follows: if <code class="computeroutput"><span class="identifier">p</span>
|
||||
<span class="special">==</span> <span class="identifier">q</span></code>
|
||||
or if <code class="computeroutput"><span class="special">*</span><span class="identifier">p</span></code>
|
||||
is not a digit character then returns -1. Otherwise performs formatted
|
||||
numeric input on the sequence [p,q) and returns the result as an
|
||||
int. Postcondition: either p == q or *p is a non-digit character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.error_string(i)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
std::string
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a human readable error string for the error condition i,
|
||||
where i is one of the values enumerated by type regex_constants::error_type.
|
||||
If the value i is not recognized then returns the string "Unknown
|
||||
error" or a localized equivalent.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.tolower(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Converts c to lower case, used for Perl-style \l and \L formating
|
||||
operations.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
v.toupper(c)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
X::char_type
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Converts c to upper case, used for Perl-style \u and \U formating
|
||||
operations.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="charT_concept.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="iterator_concepts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Deprecated Interfaces</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="concepts/iterator_concepts.html" title="Iterator Rrequirements">
|
||||
<link rel="next" href="deprecated_interfaces/regex_format.html" title="regex_format (Deprecated)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="concepts/iterator_concepts.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="deprecated_interfaces/regex_format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.deprecated_interfaces"></a><a href="deprecated_interfaces.html" title="Deprecated Interfaces">Deprecated Interfaces</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="deprecated_interfaces/regex_format.html">
|
||||
regex_format (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="deprecated_interfaces/regex_grep.html">
|
||||
regex_grep (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="deprecated_interfaces/regex_split.html">
|
||||
regex_split (deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="deprecated_interfaces/old_regex.html"> High
|
||||
Level Class RegEx (Deprecated)</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="concepts/iterator_concepts.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="deprecated_interfaces/regex_format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,825 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>High Level Class RegEx (Deprecated)</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
<link rel="prev" href="regex_split.html" title="regex_split (deprecated)">
|
||||
<link rel="next" href="../../background_information.html" title="Background Information">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_split.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../background_information.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.deprecated_interfaces.old_regex"></a><a href="old_regex.html" title="High Level Class RegEx (Deprecated)"> High
|
||||
Level Class RegEx (Deprecated)</a></h4></div></div></div>
|
||||
<p>
|
||||
The high level wrapper class RegEx is now deprecated and does not form
|
||||
part of the regular expression standardization proposal. This type still
|
||||
exists, and existing code will continue to compile, however the following
|
||||
documentation is unlikely to be further updated.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cregex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
The class RegEx provides a high level simplified interface to the regular
|
||||
expression library, this class only handles narrow character strings, and
|
||||
regular expressions always follow the "normal" syntax - that
|
||||
is the same as the perl / ECMAScript synatx.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">GrepCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">GrepFileCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">file</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">FindFilesCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">file</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">class</span> <span class="identifier">RegEx</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="identifier">RegEx</span><span class="special">();</span>
|
||||
<span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span>
|
||||
<span class="special">~</span><span class="identifier">RegEx</span><span class="special">();</span>
|
||||
<span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">c</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="keyword">explicit</span> <span class="identifier">RegEx</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="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="identifier">RegEx</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span>
|
||||
<span class="identifier">RegEx</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span>
|
||||
<span class="identifier">RegEx</span><span class="special">&</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">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">);</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">SetExpression</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">SetExpression</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="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Expression</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// now matching operators:
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">bool</span> <span class="identifier">Match</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">bool</span> <span class="identifier">Search</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">files</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</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">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</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">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</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">in</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">fmt</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">in</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">Split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">max_count</span> <span class="special">=</span> <span class="special">~</span><span class="number">0</span><span class="special">);</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// now operators for returning what matched in more detail:
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Position</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</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="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</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="keyword">bool</span> <span class="identifier">Matched</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</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="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Line</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Marks</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">What</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span> <span class="special">;</span>
|
||||
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">npos</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
Member functions for class RegEx are defined as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Member
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">();</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default constructor, constructs an instance of RegEx without any
|
||||
valid expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Copy constructor, all the properties of parameter <span class="emphasis"><em>o</em></span>
|
||||
are copied.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">c</span><span class="special">,</span> <span class="keyword">bool</span>
|
||||
<span class="identifier">icase</span> <span class="special">=</span>
|
||||
<span class="keyword">false</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Constructs an instance of RegEx, setting the expression to <span class="emphasis"><em>c</em></span>,
|
||||
if <span class="emphasis"><em>icase</em></span> is true then matching is insensitive
|
||||
to case, otherwise it is sensitive to case. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</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="keyword">bool</span>
|
||||
<span class="identifier">icase</span> <span class="special">=</span>
|
||||
<span class="keyword">false</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Constructs an instance of RegEx, setting the expression to <span class="emphasis"><em>s</em></span>,
|
||||
if <span class="emphasis"><em>icase</em></span> is true then matching is insensitive
|
||||
to case, otherwise it is sensitive to case. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</span>
|
||||
<span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default assignment operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</span>
|
||||
<span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assignment operator, equivalent to calling <code class="computeroutput"><span class="identifier">SetExpression</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="keyword">false</span><span class="special">)</span></code>. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</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">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assignment operator, equivalent to calling <code class="computeroutput"><span class="identifier">SetExpression</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="keyword">false</span><span class="special">)</span></code>. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">SetExpression</span><span class="special">(</span><span class="identifier">constchar</span><span class="special">*</span>
|
||||
<span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">icase</span>
|
||||
<span class="special">=</span> <span class="keyword">false</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Sets the current expression to <span class="emphasis"><em>p</em></span>, if <span class="emphasis"><em>icase</em></span>
|
||||
is true then matching is insensitive to case, otherwise it is sensitive
|
||||
to case. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">SetExpression</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="keyword">bool</span>
|
||||
<span class="identifier">icase</span> <span class="special">=</span>
|
||||
<span class="keyword">false</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Sets the current expression to <span class="emphasis"><em>s</em></span>, if <span class="emphasis"><em>icase</em></span>
|
||||
is true then matching is insensitive to case, otherwise it is sensitive
|
||||
to case. Throws <a href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Expression</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a copy of the current regular expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Attempts to match the current expression against the text <span class="emphasis"><em>p</em></span>
|
||||
using the match flags <span class="emphasis"><em>flags</em></span> - see <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>. Returns
|
||||
<span class="emphasis"><em>true</em></span> if the expression matches the whole of
|
||||
the input string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Match</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">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Attempts to match the current expression against the text <span class="emphasis"><em>s</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
Returns <span class="emphasis"><em>true</em></span> if the expression matches the
|
||||
whole of the input string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Attempts to find a match for the current expression somewhere in
|
||||
the text <span class="emphasis"><em>p</em></span> using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
Returns <span class="emphasis"><em>true</em></span> if the match succeeds.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Search</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">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Attempts to find a match for the current expression somewhere in
|
||||
the text <span class="emphasis"><em>s</em></span> using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags.
|
||||
Returns <span class="emphasis"><em>true</em></span> if the match succeeds.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match found calls the call-back function cb as: <code class="computeroutput"><span class="identifier">cb</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span></code>
|
||||
If at any stage the call-back function returns <span class="emphasis"><em>false</em></span>
|
||||
then the grep operation terminates, otherwise continues until no
|
||||
further matches are found. Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</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">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags.
|
||||
For each match found calls the call-back function cb as: <code class="computeroutput"><span class="identifier">cb</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span></code>
|
||||
If at any stage the call-back function returns false then the grep
|
||||
operation terminates, otherwise continues until no further matches
|
||||
are found. Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span>
|
||||
<span class="identifier">v</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags.
|
||||
For each match pushes a copy of what matched onto <span class="emphasis"><em>v</em></span>.
|
||||
Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span>
|
||||
<span class="identifier">v</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">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match pushes a copy of what matched onto <span class="emphasis"><em>v</em></span>.
|
||||
Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match pushes the starting index of what matched onto
|
||||
<span class="emphasis"><em>v</em></span>. Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</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">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span>
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match pushes the starting index of what matched onto
|
||||
<span class="emphasis"><em>v</em></span>. Returns the number of matches found.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span>
|
||||
<span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the files files
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match calls the call-back function cb. If the call-back
|
||||
returns false then the algorithm returns without considering further
|
||||
matches in the current file, or any further files. The parameter
|
||||
<span class="emphasis"><em>files</em></span> can include wild card characters '*'
|
||||
and '?', if the parameter recurse is true then searches sub-directories
|
||||
for matching file names.
|
||||
</p>
|
||||
<p>
|
||||
Returns the total number of matches found.
|
||||
</p>
|
||||
<p>
|
||||
May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if file io fails.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</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">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span>
|
||||
<span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Finds all matches of the current expression in the files files
|
||||
using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each match calls the call-back function cb.
|
||||
</p>
|
||||
<p>
|
||||
If the call-back returns false then the algorithm returns without
|
||||
considering further matches in the current file, or any further
|
||||
files.
|
||||
</p>
|
||||
<p>
|
||||
The parameter <span class="emphasis"><em>files</em></span> can include wild card
|
||||
characters '*' and '?', if the parameter recurse is true then searches
|
||||
sub-directories for matching file names.
|
||||
</p>
|
||||
<p>
|
||||
Returns the total number of matches found.
|
||||
</p>
|
||||
<p>
|
||||
May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if file io fails.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span>
|
||||
<span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Searches files to find all those which contain at least one match
|
||||
of the current expression using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each matching file calls the call-back function cb. If the
|
||||
call-back returns false then the algorithm returns without considering
|
||||
any further files.
|
||||
</p>
|
||||
<p>
|
||||
The parameter <span class="emphasis"><em>files</em></span> can include wild card
|
||||
characters '*' and '?', if the parameter <span class="emphasis"><em>recurse</em></span>
|
||||
is true then searches sub-directories for matching file names.
|
||||
</p>
|
||||
<p>
|
||||
Returns the total number of files found.
|
||||
</p>
|
||||
<p>
|
||||
May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if file io fails.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</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">files</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">recurse</span>
|
||||
<span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Searches files to find all those which contain at least one match
|
||||
of the current expression using the <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>.
|
||||
For each matching file calls the call-back function cb.
|
||||
</p>
|
||||
<p>
|
||||
If the call-back returns false then the algorithm returns without
|
||||
considering any further files.
|
||||
</p>
|
||||
<p>
|
||||
The parameter <span class="emphasis"><em>files</em></span> can include wild card
|
||||
characters '*' and '?', if the parameter <span class="emphasis"><em>recurse</em></span>
|
||||
is true then searches sub-directories for matching file names.
|
||||
</p>
|
||||
<p>
|
||||
Returns the total number of files found.
|
||||
</p>
|
||||
<p>
|
||||
May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if file io fails.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</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">in</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">fmt</span><span class="special">,</span> <span class="keyword">bool</span>
|
||||
<span class="identifier">copy</span> <span class="special">=</span>
|
||||
<span class="keyword">true</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Performs a search and replace operation: searches through the string
|
||||
<span class="emphasis"><em>in</em></span> for all occurrences of the current expression,
|
||||
for each occurrence replaces the match with the format string
|
||||
<span class="emphasis"><em>fmt</em></span>. Uses <span class="emphasis"><em>flags</em></span> to determine
|
||||
what gets matched, and how the format string should be treated.
|
||||
If <span class="emphasis"><em>copy</em></span> is true then all unmatched sections
|
||||
of input are copied unchanged to output, if the flag <span class="emphasis"><em>format_first_only</em></span>
|
||||
is set then only the first occurance of the pattern found is replaced.
|
||||
Returns the new string. See also <a href="../../format.html" title="Search and Replace Format String Syntax">format
|
||||
string syntax</a>, and <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span>
|
||||
<span class="keyword">char</span><span class="special">*</span>
|
||||
<span class="identifier">in</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="keyword">bool</span>
|
||||
<span class="identifier">copy</span> <span class="special">=</span>
|
||||
<span class="keyword">true</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Performs a search and replace operation: searches through the string
|
||||
<span class="emphasis"><em>in</em></span> for all occurrences of the current expression,
|
||||
for each occurrence replaces the match with the format string
|
||||
<span class="emphasis"><em>fmt</em></span>. Uses <span class="emphasis"><em>flags</em></span> to determine
|
||||
what gets matched, and how the format string should be treated.
|
||||
If <span class="emphasis"><em>copy</em></span> is true then all unmatched sections
|
||||
of input are copied unchanged to output, if the flag <span class="emphasis"><em>format_first_only</em></span>
|
||||
is set then only the first occurance of the pattern found is replaced.
|
||||
Returns the new string. See also <a href="../../format.html" title="Search and Replace Format String Syntax">format
|
||||
string syntax</a>, and <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="identifier">Split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</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">boost</span><span class="special">::</span><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>
|
||||
<span class="keyword">unsigned</span> <span class="identifier">max_count</span>
|
||||
<span class="special">=</span> <span class="special">~</span><span class="number">0</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Splits the input string and pushes each one onto the vector. If
|
||||
the expression contains no marked sub-expressions, then one string
|
||||
is outputted for each section of the input that does not match
|
||||
the expression. If the expression does contain marked sub-expressions,
|
||||
then outputs one string for each marked sub-expression each time
|
||||
a match occurs. Outputs no more than <span class="emphasis"><em>max_count</em></span>
|
||||
strings. Before returning, deletes from the input string <span class="emphasis"><em>s</em></span>
|
||||
all of the input that has been processed (all of the string if
|
||||
<span class="emphasis"><em>max_count</em></span> was not reached). Returns the number
|
||||
of strings pushed onto the vector.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Position</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span>
|
||||
<span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the position of what matched sub-expression <span class="emphasis"><em>i</em></span>.
|
||||
If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span>
|
||||
<span class="number">0</span></code> then returns the position
|
||||
of the whole match. Returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code>
|
||||
if the supplied index is invalid, or if the specified sub-expression
|
||||
did not participate in the match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span>
|
||||
<span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the length of what matched sub-expression i. If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span>
|
||||
<span class="number">0</span></code> then returns the length
|
||||
of the whole match. Returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code>
|
||||
if the supplied index is invalid, or if the specified sub-expression
|
||||
did not participate in the match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Matched</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span>
|
||||
<span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns true if sub-expression <span class="emphasis"><em>i</em></span> was matched,
|
||||
false otherwise.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Line</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the line on which the match occurred, indexes start from
|
||||
1 not zero, if no match occurred then returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">Marks</span><span class="special">()</span>
|
||||
<span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the number of marked sub-expressions contained in the expression.
|
||||
Note that this includes the whole match (sub-expression zero),
|
||||
so the value returned is always >= 1.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">What</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a copy of what matched sub-expression <span class="emphasis"><em>i</em></span>.
|
||||
If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span>
|
||||
<span class="number">0</span></code> then returns a copy of
|
||||
the whole match. Returns a null string if the index is invalid
|
||||
or if the specified sub-expression did not participate in a match.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span>
|
||||
<span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span> <span class="special">;</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput"><span class="identifier">what</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span></code>
|
||||
Can be used to simplify access to sub-expression matches, and make
|
||||
usage more perl-like.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_split.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../background_information.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,185 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_format (Deprecated)</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
<link rel="prev" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
<link rel="next" href="regex_grep.html" title="regex_grep (Deprecated)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_grep.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.deprecated_interfaces.regex_format"></a><a href="regex_format.html" title="regex_format (Deprecated)">
|
||||
regex_format (Deprecated)</a></h4></div></div></div>
|
||||
<p>
|
||||
The algorithm <code class="computeroutput"><span class="identifier">regex_format</span></code>
|
||||
is deprecated; new code should use <a href="../match_results.html#boost_regex.match_results_format"><code class="computeroutput"><span class="identifier">match_results</span><span class="special"><>::</span><span class="identifier">format</span></code></a> instead. Existing code
|
||||
will continue to compile, the following documentation is taken from the
|
||||
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="id634579"></a>
|
||||
<a href="regex_format.html#boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format">Algorithm
|
||||
regex_format</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>
|
||||
</pre>
|
||||
<p>
|
||||
The algorithm <code class="computeroutput"><span class="identifier">regex_format</span></code>
|
||||
takes the results of a match and creates a new string based upon a format
|
||||
string, <code class="computeroutput"><span class="identifier">regex_format</span></code> can
|
||||
be used for search and replace operations:
|
||||
</p>
|
||||
<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">iterator</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="identifier">OutputIterator</span> <span class="identifier">regex_format</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
|
||||
<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">iterator</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="identifier">OutputIterator</span> <span class="identifier">regex_format</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</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">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
The library also defines the following convenience variation of <code class="computeroutput"><span class="identifier">regex_format</span></code>, which returns the result
|
||||
directly as a string, rather than outputting to an iterator.
|
||||
</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/html/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
This version may not be available, or may be available in a more limited
|
||||
form, depending upon your compilers capabilities
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">iterator</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="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">regex_format</span>
|
||||
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">iterator</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="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">regex_format</span>
|
||||
<span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</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">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
Parameters to the main version of the function are passed as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Parameter
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">OutputIterator</span> <span class="identifier">out</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An output iterator type, the output string is sent to this iterator.
|
||||
Typically this would be a std::ostream_iterator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An instance of <a href="../match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> obtained
|
||||
from one of the matching algorithms above, and denoting what matched.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">fmt</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A format string that determines how the match is transformed into
|
||||
the new string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="identifier">flags</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Optional flags which describe how the format string is to be interpreted.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Format flags are described under <a href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>.
|
||||
</p>
|
||||
<p>
|
||||
The format string syntax (and available options) is described more fully
|
||||
under <a href="../../format.html" title="Search and Replace Format String Syntax">format strings</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_grep.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,379 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_grep (Deprecated)</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
<link rel="prev" href="regex_format.html" title="regex_format (Deprecated)">
|
||||
<link rel="next" href="regex_split.html" title="regex_split (deprecated)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_format.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_split.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.deprecated_interfaces.regex_grep"></a><a href="regex_grep.html" title="regex_grep (Deprecated)">
|
||||
regex_grep (Deprecated)</a></h4></div></div></div>
|
||||
<p>
|
||||
The algorithm <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
is deprecated in favor of <a href="../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> which provides
|
||||
a more convenient and standard library friendly interface.
|
||||
</p>
|
||||
<p>
|
||||
The following documentation is taken unchanged from the previous boost
|
||||
release, and will not be updated in future.
|
||||
</p>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">regex_grep</span></code> allows you to
|
||||
search through a bidirectional-iterator range and locate all the (non-overlapping)
|
||||
matches with a given regular expression. The function is declared as:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">iterator</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">unsigned</span> <span class="keyword">int</span> <span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">Predicate</span> <span class="identifier">foo</span><span class="special">,</span>
|
||||
<span class="identifier">iterator</span> <span class="identifier">first</span><span class="special">,</span>
|
||||
<span class="identifier">iterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<p>
|
||||
The library also defines the following convenience versions, which take
|
||||
either a <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span></code>, or a <code class="computeroutput"><span class="keyword">const</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><>&</span></code>
|
||||
in place of a pair of iterators.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Predicate</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">unsigned</span> <span class="keyword">int</span> <span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">Predicate</span> <span class="identifier">foo</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Predicate</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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">unsigned</span> <span class="keyword">int</span> <span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">Predicate</span> <span class="identifier">foo</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
<p>
|
||||
The parameters for the primary version of <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
have the following meanings:
|
||||
</p>
|
||||
<p>
|
||||
foo: A predicate function object or function pointer, see below for more
|
||||
information.
|
||||
</p>
|
||||
<p>
|
||||
first: The start of the range to search.
|
||||
</p>
|
||||
<p>
|
||||
last: The end of the range to search.
|
||||
</p>
|
||||
<p>
|
||||
e: The regular expression to search for.
|
||||
</p>
|
||||
<p>
|
||||
flags: The flags that determine how matching is carried out, one of the
|
||||
match_flags enumerators.
|
||||
</p>
|
||||
<p>
|
||||
The algorithm finds all of the non-overlapping matches of the expression
|
||||
<span class="emphasis"><em>e</em></span>, for each match it fills a <code class="computeroutput"><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">></span></code> structure, which contains information
|
||||
on what matched, and calls the predicate <span class="emphasis"><em>foo</em></span>, passing
|
||||
the <code class="computeroutput"><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">></span></code>
|
||||
as a single argument. If the predicate returns <span class="emphasis"><em>true</em></span>,
|
||||
then the grep operation continues, otherwise it terminates without searching
|
||||
for further matches. The function returns the number of matches found.
|
||||
</p>
|
||||
<p>
|
||||
The general form of the predicate is:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">struct</span> <span class="identifier">grep_predicate</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator_type</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">);</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
For example the regular expression "a*b" would find one match
|
||||
in the string "aaaaab" and two in the string "aaabb".
|
||||
</p>
|
||||
<p>
|
||||
Remember this algorithm can be used for a lot more than implementing a
|
||||
version of grep, the predicate can be and do anything that you want, grep
|
||||
utilities would output the results to the screen, another program could
|
||||
index a file based on a regular expression and store a set of bookmarks
|
||||
in a list, or a text file conversion utility would output to file. The
|
||||
results of one <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
can even be chained into another <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
to create recursive parsers.
|
||||
</p>
|
||||
<p>
|
||||
The algorithm may throw <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an <span class="emphasis"><em>N</em></span>
|
||||
character string begins to exceed O(N<sup>2</sup>), or if the program runs out of
|
||||
stack space while matching the expression (if Boost.Regex is configured
|
||||
in recursive mode), or if the matcher exhausts it's permitted memory allocation
|
||||
(if Boost.Regex is configured in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
Example: convert the example from <a href="../regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> to use <code class="computeroutput"><span class="identifier">regex_grep</span></code> instead:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="comment">// IndexClasses:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
|
||||
<span class="comment">// possibly leading whitespace:
|
||||
</span> <span class="string">"^[[:space:]]*"</span>
|
||||
<span class="comment">// possible template declaration:
|
||||
</span> <span class="string">"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="comment">// class or struct:
|
||||
</span> <span class="string">"(class|struct)[[:space:]]*"</span>
|
||||
<span class="comment">// leading declspec macros etc:
|
||||
</span> <span class="string">"("</span>
|
||||
<span class="string">"\\<\\w+\\>"</span>
|
||||
<span class="string">"("</span>
|
||||
<span class="string">"[[:blank:]]*\\([^)]*\\)"</span>
|
||||
<span class="string">")?"</span>
|
||||
<span class="string">"[[:space:]]*"</span>
|
||||
<span class="string">")*"</span>
|
||||
<span class="comment">// the class name
|
||||
</span> <span class="string">"(\\<\\w*\\>)[[:space:]]*"</span>
|
||||
<span class="comment">// template specialisation parameters
|
||||
</span> <span class="string">"(<[^;:{]+>)?[[:space:]]*"</span>
|
||||
<span class="comment">// terminate in { or :
|
||||
</span> <span class="string">"(\\{|:[^;\\{()]*\\{)"</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
|
||||
<span class="keyword">class</span> <span class="identifier">IndexClassesPred</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">map_type</span><span class="special">&</span> <span class="identifier">m</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="identifier">IndexClassesPred</span><span class="special">(</span><span class="identifier">map_type</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">m</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span> <span class="identifier">base</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special">{}</span>
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">smatch</span><span class="special">&</span> <span class="identifier">what</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[5] contains the class name.
|
||||
</span> <span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span> <span class="comment">// add class name and position to map:
|
||||
</span> <span class="identifier">m</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">second</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">second</span><span class="special">)]</span> <span class="special">=</span>
|
||||
<span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span> <span class="special">-</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">};</span>
|
||||
<span class="keyword">void</span> <span class="identifier">IndexClasses</span><span class="special">(</span><span class="identifier">map_type</span><span class="special">&</span> <span class="identifier">m</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">file</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">;</span>
|
||||
<span class="identifier">start</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">end</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">IndexClassesPred</span><span class="special">(</span><span class="identifier">m</span><span class="special">,</span> <span class="identifier">start</span><span class="special">),</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Example: Use <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
to call a global callback function:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
|
||||
<span class="comment">// possibly leading whitespace:
|
||||
</span> <span class="string">"^[[:space:]]*"</span>
|
||||
<span class="comment">// possible template declaration:
|
||||
</span> <span class="string">"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="comment">// class or struct:
|
||||
</span> <span class="string">"(class|struct)[[:space:]]*"</span>
|
||||
<span class="comment">// leading declspec macros etc:
|
||||
</span> <span class="string">"("</span>
|
||||
<span class="string">"\\<\\w+\\>"</span>
|
||||
<span class="string">"("</span>
|
||||
<span class="string">"[[:blank:]]*\\([^)]*\\)"</span>
|
||||
<span class="string">")?"</span>
|
||||
<span class="string">"[[:space:]]*"</span>
|
||||
<span class="string">")*"</span>
|
||||
<span class="comment">// the class name
|
||||
</span> <span class="string">"(\\<\\w*\\>)[[:space:]]*"</span>
|
||||
<span class="comment">// template specialisation parameters
|
||||
</span> <span class="string">"(<[^;:{]+>)?[[:space:]]*"</span>
|
||||
<span class="comment">// terminate in { or :
|
||||
</span> <span class="string">"(\\{|:[^;\\{()]*\\{)"</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
|
||||
<span class="identifier">map_type</span> <span class="identifier">class_index</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">bool</span> <span class="identifier">grep_callback</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span><span class="special">&</span> <span class="identifier">what</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[5] contains the class name.
|
||||
</span> <span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span> <span class="comment">// add class name and position to map:
|
||||
</span> <span class="identifier">class_index</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">second</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">second</span><span class="special">)]</span> <span class="special">=</span>
|
||||
<span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span> <span class="special">-</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">void</span> <span class="identifier">IndexClasses</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">file</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">;</span>
|
||||
<span class="identifier">start</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">end</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="identifier">base</span> <span class="special">=</span> <span class="identifier">start</span><span class="special">;</span>
|
||||
<span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">grep_callback</span><span class="special">,</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">expression</span><span class="special">,</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Example: use <code class="computeroutput"><span class="identifier">regex_grep</span></code>
|
||||
to call a class member function, use the standard library adapters <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span></code>
|
||||
to convert the member function into a predicate:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<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>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">functional</span><span class="special">></span>
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
<span class="keyword">class</span> <span class="identifier">class_index</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">;</span>
|
||||
<span class="identifier">map_type</span> <span class="identifier">index</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">grep_callback</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">);</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">void</span> <span class="identifier">IndexClasses</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">file</span><span class="special">);</span>
|
||||
<span class="identifier">class_index</span><span class="special">()</span>
|
||||
<span class="special">:</span> <span class="identifier">index</span><span class="special">(),</span>
|
||||
<span class="identifier">expression</span><span class="special">(</span><span class="string">"^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="string">"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"</span>
|
||||
<span class="string">"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="string">"(\\{|:[^;\\{()]*\\{)"</span>
|
||||
<span class="special">){}</span>
|
||||
<span class="special">};</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">class_index</span><span class="special">::</span><span class="identifier">grep_callback</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[5] contains the class name.
|
||||
</span> <span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span> <span class="comment">// add class name and position to map:
|
||||
</span> <span class="identifier">index</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">second</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">second</span><span class="special">)]</span> <span class="special">=</span>
|
||||
<span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span> <span class="special">-</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">class_index</span><span class="special">::</span><span class="identifier">IndexClasses</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">file</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">;</span>
|
||||
<span class="identifier">start</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">end</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="identifier">base</span> <span class="special">=</span> <span class="identifier">start</span><span class="special">;</span>
|
||||
<span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span><span class="special">(&</span><span class="identifier">class_index</span><span class="special">::</span><span class="identifier">grep_callback</span><span class="special">),</span> <span class="keyword">this</span><span class="special">),</span>
|
||||
<span class="identifier">start</span><span class="special">,</span>
|
||||
<span class="identifier">end</span><span class="special">,</span>
|
||||
<span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Finally, C++ Builder users can use C++ Builder's closure type as a callback
|
||||
argument:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<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>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">functional</span><span class="special">></span>
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
<span class="keyword">class</span> <span class="identifier">class_index</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">;</span>
|
||||
<span class="identifier">map_type</span> <span class="identifier">index</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span> <span class="identifier">arg_type</span><span class="special">;</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">grep_callback</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">arg_type</span><span class="special">&</span> <span class="identifier">what</span><span class="special">);</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(</span><span class="identifier">__closure</span><span class="special">*</span> <span class="identifier">grep_callback_type</span><span class="special">)(</span><span class="keyword">const</span> <span class="identifier">arg_type</span><span class="special">&);</span>
|
||||
<span class="keyword">void</span> <span class="identifier">IndexClasses</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">file</span><span class="special">);</span>
|
||||
<span class="identifier">class_index</span><span class="special">()</span>
|
||||
<span class="special">:</span> <span class="identifier">index</span><span class="special">(),</span>
|
||||
<span class="identifier">expression</span><span class="special">(</span><span class="string">"^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="string">"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"</span>
|
||||
<span class="string">"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="string">"(\\{|:[^;\\{()]*\\{)"</span>
|
||||
<span class="special">){}</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">bool</span> <span class="identifier">class_index</span><span class="special">::</span><span class="identifier">grep_callback</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">arg_type</span><span class="special">&</span> <span class="identifier">what</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span><span class="comment">// what[5] contains the class name.
|
||||
</span><span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span><span class="comment">// add class name and position to map:
|
||||
</span><span class="identifier">index</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">second</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">second</span><span class="special">)]</span> <span class="special">=</span>
|
||||
<span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span> <span class="special">-</span> <span class="identifier">base</span><span class="special">;</span>
|
||||
<span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">class_index</span><span class="special">::</span><span class="identifier">IndexClasses</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">file</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">;</span>
|
||||
<span class="identifier">start</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">end</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="identifier">base</span> <span class="special">=</span> <span class="identifier">start</span><span class="special">;</span>
|
||||
<span class="identifier">class_index</span><span class="special">::</span><span class="identifier">grep_callback_type</span> <span class="identifier">cl</span> <span class="special">=</span> <span class="special">&(</span><span class="keyword">this</span><span class="special">-></span><span class="identifier">grep_callback</span><span class="special">);</span>
|
||||
<span class="identifier">regex_grep</span><span class="special">(</span><span class="identifier">cl</span><span class="special">,</span>
|
||||
<span class="identifier">start</span><span class="special">,</span>
|
||||
<span class="identifier">end</span><span class="special">,</span>
|
||||
<span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_format.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_split.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,162 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_split (deprecated)</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../deprecated_interfaces.html" title="Deprecated Interfaces">
|
||||
<link rel="prev" href="regex_grep.html" title="regex_grep (Deprecated)">
|
||||
<link rel="next" href="old_regex.html" title="High Level Class RegEx (Deprecated)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_grep.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="old_regex.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.deprecated_interfaces.regex_split"></a><a href="regex_split.html" title="regex_split (deprecated)">
|
||||
regex_split (deprecated)</a></h4></div></div></div>
|
||||
<p>
|
||||
The algorithm <a href="regex_split.html" title="regex_split (deprecated)"><code class="computeroutput"><span class="identifier">regex_split</span></code></a> has been deprecated
|
||||
in favor of the iterator <a href="../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> which has
|
||||
a more flexible and powerful interface, as well as following the more usual
|
||||
standard library "pull" rather than "push" semantics.
|
||||
</p>
|
||||
<p>
|
||||
Code which uses <a href="regex_split.html" title="regex_split (deprecated)"><code class="computeroutput"><span class="identifier">regex_split</span></code></a> will continue to compile,
|
||||
the following documentation is taken from a previous Boost.Regex version:
|
||||
</p>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
Algorithm <a href="regex_split.html" title="regex_split (deprecated)"><code class="computeroutput"><span class="identifier">regex_split</span></code></a> performs a similar
|
||||
operation to the perl split operation, and comes in three overloaded forms:
|
||||
</p>
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits2</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">regex_split</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</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">Traits1</span><span class="special">,</span> <span class="identifier">Alloc1</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits2</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span><span class="special">,</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">max_split</span><span class="special">);</span>
|
||||
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits2</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">regex_split</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</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">Traits1</span><span class="special">,</span> <span class="identifier">Alloc1</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits2</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><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>
|
||||
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc1</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">regex_split</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</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">Traits1</span><span class="special">,</span> <span class="identifier">Alloc1</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Each version of the algorithm
|
||||
takes an output-iterator for output, and a string for input. If the expression
|
||||
contains no marked sub-expressions, then the algorithm writes one string
|
||||
onto the output-iterator for each section of input that does not match
|
||||
the expression. If the expression does contain marked sub-expressions,
|
||||
then each time a match is found, one string for each marked sub-expression
|
||||
will be written to the output-iterator. No more than max_split strings
|
||||
will be written to the output-iterator. Before returning, all the input
|
||||
processed will be deleted from the string <span class="emphasis"><em>s</em></span> (if <span class="emphasis"><em>max_split</em></span>
|
||||
is not reached then all of <span class="emphasis"><em>s</em></span> will be deleted). Returns
|
||||
the number of strings written to the output-iterator. If the parameter
|
||||
<span class="emphasis"><em>max_split</em></span> is not specified then it defaults to <code class="computeroutput"><span class="identifier">UINT_MAX</span></code>. If no expression is specified,
|
||||
then it defaults to "\s+", and splitting occurs on whitespace.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while
|
||||
matching the expression (if Boost.Regex is configured in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.Regex
|
||||
is configured in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example</strong></span>: the following function will split
|
||||
the input string into a series of tokens, and remove each token from the
|
||||
string <span class="emphasis"><em>s</em></span>:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">unsigned</span> <span class="identifier">tokenise</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">l</span><span class="special">,</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="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">l</span><span class="special">),</span> <span class="identifier">s</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Example: the following short program will extract all of the URL's from
|
||||
a html file, and print them out to cout:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">list</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\""</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regbase</span><span class="special">::</span><span class="identifier">normal</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regbase</span><span class="special">::</span><span class="identifier">icase</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">load_file</span><span class="special">(</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">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// attempt to grow string buffer to match file size,
|
||||
</span> <span class="comment">// this doesn't always work...
|
||||
</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">()-&</span><span class="identifier">gtin_avail</span><span class="special">());</span>
|
||||
<span class="keyword">char</span> <span class="identifier">c</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">c</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// use logarithmic growth stategy, in case
|
||||
</span> <span class="comment">// in_avail (above) returned zero:
|
||||
</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">*</span> <span class="number">3</span><span class="special">);</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">append</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">**</span> <span class="identifier">argv</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="identifier">l</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Findings URL's in "</span> <span class="special"><<</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="string">":"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">is</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
|
||||
<span class="identifier">load_file</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">is</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">l</span><span class="special">),</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">l</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">s</span> <span class="special">=</span> <span class="special">*(</span><span class="identifier">l</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
|
||||
<span class="identifier">l</span><span class="special">.</span><span class="identifier">pop_front</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">s</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_grep.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="old_regex.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,267 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>error_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="match_flag_type.html" title="match_flag_type">
|
||||
<link rel="next" href="regex_traits.html" title="regex_traits">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="match_flag_type.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_traits.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.error_type"></a><a 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="id612242"></a>
|
||||
<a href="error_type.html#boost_regex.ref.error_type.synopsis">Synopsis</a>
|
||||
</h5>
|
||||
<p>
|
||||
Type error type represents the different types of errors that can be raised
|
||||
by the library when parsing a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">regex_constants</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">implementation</span><span class="special">-</span><span class="identifier">specific</span><span class="special">-</span><span class="identifier">type</span> <span class="identifier">error_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_collate</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_ctype</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_escape</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_backref</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_brack</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_paren</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_brace</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_badbrace</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_range</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_space</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_badrepeat</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_complexity</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_stack</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">error_type</span> <span class="identifier">error_bad_pattern</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span> <span class="comment">// namespace regex_constants
|
||||
</span><span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.error_type.description"></a><h5>
|
||||
<a name="id612809"></a>
|
||||
<a href="error_type.html#boost_regex.ref.error_type.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
The type <code class="computeroutput"><span class="identifier">error_type</span></code> is an
|
||||
implementation-specific enumeration type that may take one of the following
|
||||
values:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Constant
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_collate
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An invalid collating element was specified in a [[.name.]] block.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_ctype
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An invalid character class name was specified in a [[:name:]] block.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_escape
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An invalid or trailing escape was encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_backref
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A back-reference to a non-existant marked sub-expression was encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_brack
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An invalid character set [...] was encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_paren
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Mismatched '(' and ')'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_brace
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Mismatched '{' and '}'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_badbrace
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Invalid contents of a {...} block.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_range
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A character range was invalid, for example [d-a].
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_space
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Out of memory.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_badrepeat
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An attempt to repeat something that can not be repeated - for example
|
||||
a*+
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_complexity
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The expression became too complex to handle.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_stack
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Out of program stack space.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
error_bad_pattern
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other unspecified errors.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="match_flag_type.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_traits.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,433 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>match_flag_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="syntax_option_type/syntax_option_type_literal.html" title="Options for Literal Strings">
|
||||
<link rel="next" href="error_type.html" title="error_type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type/syntax_option_type_literal.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="error_type.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.match_flag_type"></a><a href="match_flag_type.html" title="match_flag_type"> match_flag_type</a></h3></div></div></div>
|
||||
<p>
|
||||
The type <code class="computeroutput"><span class="identifier">match_flag_type</span></code>
|
||||
is an implementation specific bitmask type (see C++ std 17.3.2.1.2) that
|
||||
controls how a regular expression is matched against a character sequence.
|
||||
The behavior of the format flags is described in more detail in the <a href="../format.html" title="Search and Replace Format String Syntax">format syntax guide</a>.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">regex_constants</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">implemenation</span><span class="special">-</span><span class="identifier">specific</span><span class="special">-</span><span class="identifier">bitmask</span><span class="special">-</span><span class="identifier">type</span> <span class="identifier">match_flag_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_default</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bob</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eob</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bol</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eol</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bow</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eow</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_any</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_null</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_continuous</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_partial</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_single_line</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_prev_avail</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_dot_newline</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_dot_null</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_default</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_sed</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_perl</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_literal</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_no_copy</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_first_only</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_all</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span> <span class="comment">// namespace regex_constants
|
||||
</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="id611579"></a>
|
||||
<a href="match_flag_type.html#boost_regex.ref.match_flag_type.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
The type <code class="computeroutput"><span class="identifier">match_flag_type</span></code>
|
||||
is an implementation specific bitmask type (see C++ std 17.3.2.1.2). When
|
||||
matching a regular expression against a sequence of characters [first, last)
|
||||
then setting its elements has the effects listed in the table below:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect if set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_default
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that matching of regular expressions proceeds without any
|
||||
modification of the normal rules used in ECMA-262, ECMAScript Language
|
||||
Specification, Chapter 15 part 10, RegExp (Regular Expression) Objects
|
||||
(FWD.1)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_bob
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expressions "\A" and "\`"
|
||||
should not match against the sub-sequence [first,first).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_eob
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expressions "\'", "\z" and
|
||||
"\Z" should not match against the sub-sequence [last,last).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_bol
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expression "^" should not be matched
|
||||
against the sub-sequence [first,first).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_eol
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expression "$" should not be matched
|
||||
against the sub-sequence [last,last).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_bow
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expressions "\<" and "\b"
|
||||
should not be matched against the sub-sequence [first,first).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_eow
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expressions "\>" and "\b"
|
||||
should not be matched against the sub-sequence [last,last).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_any
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that if more than one match is possible then any match
|
||||
is an acceptable result: this will still find the leftmost match,
|
||||
but may not find the "best" match at that position. Use
|
||||
this flag if you care about the speed of matching, but don't care
|
||||
what was matched (only whether there is one or not).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_null
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expression can not be matched against an empty
|
||||
sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_continuous
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expression must match a sub-sequence that begins
|
||||
at first.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_partial
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that if no match can be found, then it is acceptable to
|
||||
return a match [from, last) such that from!= last, if there could
|
||||
exist some longer sequence of characters [from,to) of which [from,last)
|
||||
is a prefix, and which would result in a full match. This flag is
|
||||
used when matching incomplete or very long texts, see the partial
|
||||
matches documentation for more information.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_extra
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Instructs the matching engine to retain all available capture information;
|
||||
if a capturing group is repeated then information about every repeat
|
||||
is available via match_results::captures() or sub_match_captures().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_single_line
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Equivalent to the inverse of Perl's m/ modifier; prevents ^ from
|
||||
matching after an embedded newline character (so that it only matches
|
||||
at the start of the text being matched), and $ from matching before
|
||||
an embedded newline (so that it only matches at the end of the text
|
||||
being matched).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_prev_avail
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that --first is a valid iterator position, when this flag
|
||||
is set then the flags match_not_bol and match_not_bow are ignored
|
||||
by the regular expression algorithms (RE.7) and iterators (RE.8).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_dot_newline
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the expression "." does not match a newline
|
||||
character. This is the inverse of Perl's s/ modifier.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
match_not_dot_null
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specified that the expression "." does not match a character
|
||||
null '\0'.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_default
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression match is to be replaced
|
||||
by a new string, that the new string is constructed using the rules
|
||||
used by the ECMAScript replace function in ECMA-262, ECMAScript Language
|
||||
Specification, Chapter 15 part 5.4.11 String.prototype.replace. (FWD.1).
|
||||
This is functionally identical to the <a href="../format/perl_format.html" title="Perl Format String Syntax">Perl
|
||||
format string rules</a>. In addition during search and replace
|
||||
operations then all non-overlapping occurrences of the regular expression
|
||||
are located and replaced, and sections of the input that did not
|
||||
match the expression, are copied unchanged to the output string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_sed
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression match is to be replaced
|
||||
by a new string, that the new string is constructed using the rules
|
||||
used by the Unix sed utility in IEEE Std 1003.1-2001, Portable Operating
|
||||
SystemInterface (POSIX ), Shells and Utilities. See also the <a href="../format/sed_format.html" title="Sed Format String Syntax">Sed Format string reference</a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_perl
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression match is to be replaced
|
||||
by a new string, that the new string is constructed using <a href="../format/perl_format.html" title="Perl Format String Syntax">the
|
||||
same rules as Perl 5</a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_literal
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specified that when a regular expression match is to be replaced
|
||||
by a new string, that the new string is a literal copy of the replacement
|
||||
text.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_all
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that all syntax extensions are enabled, including conditional
|
||||
(?ddexpression1:expression2) replacements: see the <a href="../format/boost_format_syntax.html" title="Boost-Extended Format String Syntax">format
|
||||
string guide</a> for more details.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_no_copy
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When specified during a search and replace operation, then sections
|
||||
of the character container sequence being searched that do match
|
||||
the regular expression, are not copied to the output string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
format_first_only
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When specified during a search and replace operation, then only the
|
||||
first occurrence of the regular expression is replaced.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type/syntax_option_type_literal.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="error_type.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,641 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>match_results</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="basic_regex.html" title="basic_regex">
|
||||
<link rel="next" href="sub_match.html" title="sub_match">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_regex.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="sub_match.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.match_results"></a><a 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="id541637"></a>
|
||||
<a 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>
|
||||
</pre>
|
||||
<p>
|
||||
Regular expressions are different from many simple pattern-matching algorithms
|
||||
in that as well as finding an overall match they can also produce sub-expression
|
||||
matches: each sub-expression being delimited in the pattern by a pair of
|
||||
parenthesis (...). There has to be some method for reporting sub-expression
|
||||
matches back to the user: this is achieved this by defining a class <code class="computeroutput"><span class="identifier">match_results</span></code> that acts as an indexed collection
|
||||
of sub-expression matches, each sub-expression match being contained in an
|
||||
object of type <a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>.
|
||||
</p>
|
||||
<p>
|
||||
Template class <code class="computeroutput"><span class="identifier">match_results</span></code>
|
||||
denotes a collection of character sequences representing the result of a
|
||||
regular expression match. Objects of type <code class="computeroutput"><span class="identifier">match_results</span></code>
|
||||
are passed to the algorithms <a href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> and <a href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, and are returned by
|
||||
the iterator <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>. Storage for the
|
||||
collection is allocated and freed as necessary by the member functions of
|
||||
class <code class="computeroutput"><span class="identifier">match_results</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The template class <code class="computeroutput"><span class="identifier">match_results</span></code>
|
||||
conforms to the requirements of a Sequence, as specified in (lib.sequence.reqmts),
|
||||
except that only operations defined for const-qualified Sequences are supported.
|
||||
</p>
|
||||
<p>
|
||||
Class template <code class="computeroutput"><span class="identifier">match_results</span></code>
|
||||
is most commonly used as one of the typedefs <code class="computeroutput"><span class="identifier">cmatch</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">wcmatch</span></code>, <code class="computeroutput"><span class="identifier">smatch</span></code>,
|
||||
or <code class="computeroutput"><span class="identifier">wsmatch</span></code>:
|
||||
</p>
|
||||
<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="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">match_results</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">cmatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span> <span class="identifier">wcmatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">smatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">wstring</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">wsmatch</span><span class="special">;</span>
|
||||
|
||||
<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="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">match_results</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">value_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">const_reference</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">const_reference</span> <span class="identifier">reference</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">implementation</span> <span class="identifier">defined</span> <span class="identifier">const_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">const_iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Allocator</span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">Allocator</span> <span class="identifier">allocator_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">value_type</span> <span class="identifier">char_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">></span> <span class="identifier">string_type</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// construct/copy/destroy:
|
||||
</span> <a href="match_results.html#boost_regex.match_results.construct">explicit match_results</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Allocator</span><span class="special">&</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">Allocator</span><span class="special">());</span>
|
||||
<a href="match_results.html#boost_regex.match_results.copy_construct">match_results</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span>
|
||||
<a href="match_results.html#boost_regex.match_results.assign">match_results& operator=</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span>
|
||||
<span class="special">~</span><span class="identifier">match_results</span><span class="special">();</span>
|
||||
|
||||
<span class="comment">// size:
|
||||
</span> <span class="identifier">size_type</span> <a href="match_results.html#boost_regex.match_results.size">size</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">size_type</span> <a href="match_results.html#boost_regex.match_results.max_size">max_size</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">bool</span> <a 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 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 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">string_type</span> <a 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">const_reference</span> <a 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 href="match_results.html#boost_regex.match_results.prefix">prefix</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">const_reference</span> <a href="match_results.html#boost_regex.match_results.suffix">suffix</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">const_iterator</span> <a href="match_results.html#boost_regex.match_results.begin">begin</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">const_iterator</span> <a href="match_results.html#boost_regex.match_results.end">end</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="comment">// format:
|
||||
</span> <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="identifier">OutputIterator</span> <a href="match_results.html#boost_regex.match_results.format">format</a><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">string_type</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">string_type</span> <a href="match_results.html#boost_regex.match_results.format2">format</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">string_type</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">allocator_type</span> <a href="match_results.html#boost_regex.match_results.get_allocator">get_allocator</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">void</span> <a href="match_results.html#boost_regex.match_results.swap">swap</a><span class="special">(</span><span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span>
|
||||
|
||||
<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_REGEX_MATCH_EXTRA</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">::</span><span class="identifier">capture_sequence_type</span> <span class="identifier">capture_sequence_type</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">capture_sequence_type</span><span class="special">&</span> <a href="match_results.html#boost_regex.match_results.captures">captures</a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
|
||||
<span class="special">};</span>
|
||||
|
||||
<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">bool</span> <a href="match_results.html#boost_regex.match_results.op_eq">operator ==</a> <span class="special">(</span><span class="keyword">const</span> <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">m1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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>
|
||||
<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">bool</span> <a href="match_results.html#boost_regex.match_results.op_ne">operator !=</a> <span class="special">(</span><span class="keyword">const</span> <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">m1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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>
|
||||
|
||||
<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">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span>
|
||||
<span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">>&</span>
|
||||
<a href="match_results.html#boost_regex.match_results.op_stream">operator <<</a> <span class="special">(</span><span class="identifier">basic_ostream</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">os</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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">m</span><span class="special">);</span>
|
||||
|
||||
<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">void</span> <a href="match_results.html#boost_regex.match_results.op_swap">swap</a><span class="special">(</span><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">m1</span><span class="special">,</span>
|
||||
<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="id544553"></a>
|
||||
<a href="match_results.html#boost_regex.ref.match_results.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
In all <code class="computeroutput"><span class="identifier">match_results</span></code> constructors,
|
||||
a copy of the Allocator argument is used for any memory allocation performed
|
||||
by the constructor or member functions during the lifetime of the object.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.construct"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">match_results</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Allocator</span><span class="special">&</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">Allocator</span><span class="special">());</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Constructs an object of class
|
||||
<code class="computeroutput"><span class="identifier">match_results</span></code>. The postconditions
|
||||
of this function are indicated in the table:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Value
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
empty()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
size()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
0
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
str()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
basic_string<charT>()
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.match_results.copy_construct"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">match_results</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Constructs an object of class match_results,
|
||||
as a copy of m.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.assign"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">match_results</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Assigns m to *this. The postconditions
|
||||
of this function are indicated in the table:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Value
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
empty()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.empty().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
size()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.size().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
str(n)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.str(n) for all integers n < m.size().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
prefix()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.prefix().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
suffix()
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.suffix().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
(*this)[n]
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m[n] for all integers n < m.size().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
length(n)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.length(n) for all integers n < m.size().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
position(n)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
m.position(n) for all integers n < m.size().
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.match_results.size"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">size_type</span> <span class="identifier">size</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 number of <a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> elements stored in *this;
|
||||
that is the number of marked sub-expressions in the regular expression that
|
||||
was matched plus one.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.max_size"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">size_type</span> <span class="identifier">max_size</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 maximum number of
|
||||
<a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
elements that can be stored in *this.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.empty"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns size() == 0.
|
||||
</p>
|
||||
<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>
|
||||
</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>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns the starting location of
|
||||
sub-expression <span class="emphasis"><em>sub</em></span>, or -1 if <span class="emphasis"><em>sub</em></span>
|
||||
was not matched. Note that if this represents a partial match , then <code class="computeroutput"><span class="identifier">position</span><span class="special">()</span></code>
|
||||
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>
|
||||
<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>
|
||||
</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>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a 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 marked sub-expression
|
||||
<span class="emphasis"><em>n</em></span>. If <code class="computeroutput"><span class="identifier">n</span> <span class="special">==</span> <span class="number">0</span></code> then returns
|
||||
a reference to a <a 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 whole regular expression. If <span class="emphasis"><em>n</em></span>
|
||||
is out of range, or if <span class="emphasis"><em>n</em></span> is an unmatched sub-expression,
|
||||
then returns a <a 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>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
object representing the character sequence from the start of the string being
|
||||
matched or searched, to the start of the match found.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.suffix"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">const_reference</span> <span class="identifier">suffix</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 href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
object representing the character sequence from the end of the match found
|
||||
to the end of the string being matched or searched.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.begin"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">const_iterator</span> <span class="identifier">begin</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 starting iterator that
|
||||
enumerates over all the marked sub-expression matches stored in *this.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.end"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">const_iterator</span> <span class="identifier">end</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 terminating iterator
|
||||
that enumerates over all the marked sub-expression matches stored in *this.
|
||||
</p>
|
||||
<a name="boost_regex.match_results_format"></a><a name="boost_regex.match_results.format"></a><p>
|
||||
</p>
|
||||
<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="identifier">OutputIterator</span> <span class="identifier">format</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">string_type</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Requires</strong></span>: The type <code class="computeroutput"><span class="identifier">OutputIterator</span></code>
|
||||
conforms to the Output Iterator requirements (C++ std 24.1.2).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Copies the character sequence
|
||||
<code class="computeroutput"><span class="special">[</span><span class="identifier">fmt</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">fmt</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span></code>
|
||||
to <code class="computeroutput"><span class="identifier">OutputIterator</span></code> <span class="emphasis"><em>out</em></span>.
|
||||
For each format specifier or escape sequence in <span class="emphasis"><em>fmt</em></span>,
|
||||
replace that sequence with either the character(s) it represents, or the
|
||||
sequence of characters within <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> to which it refers. The bitmasks specified
|
||||
in flags determines what format specifiers or escape sequences are recognized,
|
||||
by default this is the format used by ECMA-262, ECMAScript Language Specification,
|
||||
Chapter 15 part 5.4.11 String.prototype.replace.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="../format.html" title="Search and Replace Format String Syntax">format syntax guide for more information</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: out.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.format2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">string_type</span> <span class="identifier">format</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">string_type</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Returns a copy of the string <span class="emphasis"><em>fmt</em></span>.
|
||||
For each format specifier or escape sequence in <span class="emphasis"><em>fmt</em></span>,
|
||||
replace that sequence with either the character(s) it represents, or the
|
||||
sequence of characters within <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> to which it refers. The bitmasks specified
|
||||
in flags determines what format specifiers or escape sequences are recognized,
|
||||
by default this is the format used by ECMA-262, ECMAScript Language Specification,
|
||||
Chapter 15 part 5.4.11 String.prototype.replace.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="../format.html" title="Search and Replace Format String Syntax">format syntax guide for more information</a>.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.get_allocator"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">allocator_type</span> <span class="identifier">get_allocator</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 copy of the Allocator
|
||||
that was passed to the object's constructor.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.swap"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Swaps the contents of the two sequences.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postcondition</strong></span>: *this contains the sequence
|
||||
of matched sub-expressions that were in that, that contains the sequence
|
||||
of matched sub-expressions that were in *this.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Complexity</strong></span>: constant time.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.capture_type"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">::</span><span class="identifier">capture_sequence_type</span> <span class="identifier">capture_sequence_type</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
Defines an implementation-specific type that satisfies the requirements of
|
||||
a standard library Sequence (21.1.1 including the optional Table 68 operations),
|
||||
whose value_type is a <code class="computeroutput"><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span></code>. This type happens to be <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span></code>,
|
||||
but you shouldn't actually rely on that.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.captures"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">const</span> <span class="identifier">capture_sequence_type</span><span class="special">&</span> <span class="identifier">captures</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</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 sequence containing all
|
||||
the captures obtained for sub-expression i.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">i</span><span class="special">].</span><span class="identifier">captures</span><span class="special">();</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Preconditions</strong></span>: the library must be built
|
||||
and used with BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag
|
||||
match_extra to the regex matching functions ( <a href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>, <a href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a>) in order for
|
||||
this member function to be defined and return useful information.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Rationale</strong></span>: Enabling this feature has several
|
||||
consequences:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
sub_match occupies more memory resulting in complex expressions running
|
||||
out of memory or stack space more quickly during matching.
|
||||
</li>
|
||||
<li>
|
||||
The matching algorithms are less efficient at handling some features (independent
|
||||
sub-expressions for example), even when match_extra is not used.
|
||||
</li>
|
||||
<li>
|
||||
The matching algorithms are much less efficient (i.e. slower), when match_extra
|
||||
is used. Mostly this is down to the extra memory allocations that have
|
||||
to take place.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.match_results.op_eq"></a><p>
|
||||
</p>
|
||||
<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">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <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">m1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Compares the two sequences for
|
||||
equality.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.op_ne"></a><p>
|
||||
</p>
|
||||
<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">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <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">m1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Compares the two sequences for
|
||||
inequality.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.op_stream"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span>
|
||||
<span class="identifier">basic_ostream</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="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">basic_ostream</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">os</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <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">m</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Writes the contents of <span class="emphasis"><em>m</em></span>
|
||||
to the stream <span class="emphasis"><em>os</em></span> as if by calling <code class="computeroutput"><span class="identifier">os</span>
|
||||
<span class="special"><<</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span></code>;
|
||||
Returns <span class="emphasis"><em>os</em></span>.
|
||||
</p>
|
||||
<a name="boost_regex.match_results.op_swap"></a><p>
|
||||
</p>
|
||||
<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">void</span> <span class="identifier">swap</span><span class="special">(</span><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">m1</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Swaps the contents of the two sequences.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_regex.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="sub_match.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Interfacing With Non-Standard String Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_traits.html" title="regex_traits">
|
||||
<link rel="next" href="non_std_strings/icu.html" title="Working With Unicode and ICU String Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_traits.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_std_strings/icu.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings"></a><a href="non_std_strings.html" title="Interfacing With Non-Standard String Types"> Interfacing With Non-Standard
|
||||
String Types</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="non_std_strings/icu.html"> Working With
|
||||
Unicode and ICU String Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="non_std_strings/icu/intro.html"> Introduction
|
||||
to using Regex with ICU</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/icu/unicode_types.html">
|
||||
Unicode regular expression types</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/icu/unicode_algo.html">
|
||||
Unicode Regular Expression Algorithms</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/icu/unicode_iter.html">
|
||||
Unicode Aware Regex Iterators</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings.html"> Using
|
||||
Boost Regex With MFC Strings</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings/mfc_intro.html">
|
||||
Introduction to Boost.Regex and MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings/mfc_regex_types.html">
|
||||
Regex Types Used With MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings/mfc_regex_create.html">
|
||||
Regular Expression Creation From an MFC String</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings/mfc_algo.html">
|
||||
Overloaded Algorithms For MFC String Types</a></span></dt>
|
||||
<dt><span class="section"><a href="non_std_strings/mfc_strings/mfc_iter.html">
|
||||
Iterating Over the Matches Within An MFC String</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></div>
|
||||
<p>
|
||||
The Boost.Regex algorithms and iterators are all iterator-based, with convenience
|
||||
overloads of the algorithms provided that convert standard library string
|
||||
types to iterator pairs internally. If you want to search a non-standard
|
||||
string type then the trick is to convert that string into an iterator pair:
|
||||
so far I haven't come across any string types that can't be handled this
|
||||
way, even if they're not officially iterator based. Certainly any string
|
||||
type that provides access to it's internal buffer, along with it's length,
|
||||
can be converted into a pair of pointers (which can be used as iterators).
|
||||
</p>
|
||||
<p>
|
||||
Some non-standard string types are sufficiently common that wappers have
|
||||
been provided for them already: currently this includes the ICU and MFC string
|
||||
class types.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_traits.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_std_strings/icu.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Working With Unicode and ICU String Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../non_std_strings.html" title="Interfacing With Non-Standard String Types">
|
||||
<link rel="prev" href="../non_std_strings.html" title="Interfacing With Non-Standard String Types">
|
||||
<link rel="next" href="icu/intro.html" title="Introduction to using Regex with ICU">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="icu/intro.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.icu"></a><a href="icu.html" title="Working With Unicode and ICU String Types"> Working With
|
||||
Unicode and ICU String Types</a></h4></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="icu/intro.html"> Introduction
|
||||
to using Regex with ICU</a></span></dt>
|
||||
<dt><span class="section"><a href="icu/unicode_types.html">
|
||||
Unicode regular expression types</a></span></dt>
|
||||
<dt><span class="section"><a href="icu/unicode_algo.html">
|
||||
Unicode Regular Expression Algorithms</a></span></dt>
|
||||
<dt><span class="section"><a href="icu/unicode_iter.html">
|
||||
Unicode Aware Regex Iterators</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="icu/intro.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Introduction to using Regex with ICU</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../icu.html" title="Working With Unicode and ICU String Types">
|
||||
<link rel="prev" href="../icu.html" title="Working With Unicode and ICU String Types">
|
||||
<link rel="next" href="unicode_types.html" title="Unicode regular expression types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../icu.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_types.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.icu.intro"></a><a href="intro.html" title="Introduction to using Regex with ICU"> Introduction
|
||||
to using Regex with ICU</a></h5></div></div></div>
|
||||
<p>
|
||||
The header:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">icu</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
contains the data types and algorithms necessary for working with regular
|
||||
expressions in a Unicode aware environment.
|
||||
</p>
|
||||
<p>
|
||||
In order to use this header you will need the <a href="http://www.ibm.com/software/globalization/icu/" target="_top">ICU
|
||||
library</a>, and you will need to have built the Boost.Regex library
|
||||
with <a href="../../../install.html#boost_regex.install.building_with_unicode_and_icu_support">ICU
|
||||
support enabled</a>.
|
||||
</p>
|
||||
<p>
|
||||
The header will enable you to:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
Create regular expressions that treat Unicode strings as sequences
|
||||
of UTF-32 code points.
|
||||
</li>
|
||||
<li>
|
||||
Create regular expressions that support various Unicode data properties,
|
||||
including character classification.
|
||||
</li>
|
||||
<li>
|
||||
Transparently search Unicode strings that are encoded as either UTF-8,
|
||||
UTF-16 or UTF-32.
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../icu.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_types.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,179 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Unicode Regular Expression Algorithms</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../icu.html" title="Working With Unicode and ICU String Types">
|
||||
<link rel="prev" href="unicode_types.html" title="Unicode regular expression types">
|
||||
<link rel="next" href="unicode_iter.html" title="Unicode Aware Regex Iterators">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode_types.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_iter.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo"></a><a href="unicode_algo.html" title="Unicode Regular Expression Algorithms">
|
||||
Unicode Regular Expression Algorithms</a></h5></div></div></div>
|
||||
<p>
|
||||
The regular expression algorithms <a href="../../regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>, <a href="../../regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> and <a href="../../regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a> all expect that
|
||||
the character sequence upon which they operate, is encoded in the same
|
||||
character encoding as the regular expression object with which they are
|
||||
used. For Unicode regular expressions that behavior is undesirable: while
|
||||
we may want to process the data in UTF-32 "chunks", the actual
|
||||
data is much more likely to encoded as either UTF-8 or UTF-16. Therefore
|
||||
the header <boost/regex/icu.hpp> provides a series of thin wrappers
|
||||
around these algorithms, called <code class="computeroutput"><span class="identifier">u32regex_match</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">u32regex_search</span></code>, and
|
||||
<code class="computeroutput"><span class="identifier">u32regex_replace</span></code>. These
|
||||
wrappers use iterator-adapters internally to make external UTF-8 or UTF-16
|
||||
data look as though it's really a UTF-32 sequence, that can then be passed
|
||||
on to the "real" algorithm.
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match"></a><h5>
|
||||
<a name="id615282"></a>
|
||||
<a href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match">u32regex_match</a>
|
||||
</h5>
|
||||
<p>
|
||||
For each <a href="../../regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>
|
||||
algorithm defined by <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">hpp</span><span class="special">></span></code>,
|
||||
then <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">icu</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> defines an overloaded algorithm that
|
||||
takes the same arguments, but which is called <code class="computeroutput"><span class="identifier">u32regex_match</span></code>,
|
||||
and which will accept UTF-8, UTF-16 or UTF-32 encoded data, as well as
|
||||
an ICU UnicodeString as input.
|
||||
</p>
|
||||
<p>
|
||||
Example: match a password, encoded in a UTF-16 UnicodeString:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Find out if *password* meets our password requirements,
|
||||
</span><span class="comment">// as defined by the regular expression *requirements*.
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">bool</span> <span class="identifier">is_valid_password</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">password</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">requirements</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_match</span><span class="special">(</span><span class="identifier">password</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">requirements</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Example: match a UTF-8 encoded filename:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Extract filename part of a path from a UTF-8 encoded std::string and return the result
|
||||
</span><span class="comment">// as another std::string:
|
||||
</span><span class="comment">//
|
||||
</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">get_filename</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">path</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="string">"(?:\\A|.*\\\\)([^\\\\]+)"</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">smatch</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_match</span><span class="special">(</span><span class="identifier">path</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">r</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// extract $1 as a CString:
|
||||
</span> <span class="keyword">return</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">str</span><span class="special">(</span><span class="number">1</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">(</span><span class="string">"Invalid pathname"</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search"></a><h5>
|
||||
<a name="id616006"></a>
|
||||
<a href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search">u32regex_search</a>
|
||||
</h5>
|
||||
<p>
|
||||
For each <a href="../../regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>
|
||||
algorithm defined by <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">hpp</span><span class="special">></span></code>,
|
||||
then <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">icu</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> defines an overloaded algorithm that
|
||||
takes the same arguments, but which is called <code class="computeroutput"><span class="identifier">u32regex_search</span></code>,
|
||||
and which will accept UTF-8, UTF-16 or UTF-32 encoded data, as well as
|
||||
an ICU UnicodeString as input.
|
||||
</p>
|
||||
<p>
|
||||
Example: search for a character sequence in a specific language block:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">UnicodeString</span> <span class="identifier">extract_greek</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">text</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// searches through some UTF-16 encoded text for a block encoded in Greek,
|
||||
</span> <span class="comment">// this expression is imperfect, but the best we can do for now - searching
|
||||
</span> <span class="comment">// for specific scripts is actually pretty hard to do right.
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="comment">// Here we search for a character sequence that begins with a Greek letter,
|
||||
</span> <span class="comment">// and continues with characters that are either not-letters ( [^[:L*:]] )
|
||||
</span> <span class="comment">// or are characters in the Greek character block ( [\\x{370}-\\x{3FF}] ).
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span>
|
||||
<span class="identifier">L</span><span class="string">"[\\x{370}-\\x{3FF}](?:[^[:L*:]]|[\\x{370}-\\x{3FF}])*"</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u16match</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_search</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">r</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// extract $0 as a CString:
|
||||
</span> <span class="keyword">return</span> <span class="identifier">UnicodeString</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">length</span><span class="special">(</span><span class="number">0</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">(</span><span class="string">"No Greek found!"</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace"></a><h5>
|
||||
<a name="id616602"></a>
|
||||
<a href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace">u32regex_replace</a>
|
||||
</h5>
|
||||
<p>
|
||||
For each <a href="../../regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a> algorithm defined
|
||||
by <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">hpp</span><span class="special">></span></code>, then <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">icu</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
defines an overloaded algorithm that takes the same arguments, but which
|
||||
is called <code class="computeroutput"><span class="identifier">u32regex_replace</span></code>,
|
||||
and which will accept UTF-8, UTF-16 or UTF-32 encoded data, as well as
|
||||
an ICU UnicodeString as input. The input sequence and the format string
|
||||
specifier passed to the algorithm, can be encoded independently (for
|
||||
example one can be UTF-8, the other in UTF-16), but the result string
|
||||
/ output iterator argument must use the same character encoding as the
|
||||
text being searched.
|
||||
</p>
|
||||
<p>
|
||||
Example: Credit card number reformatting:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Take a credit card number as a string of digits,
|
||||
</span><span class="comment">// and reformat it as a human readable string with "-"
|
||||
</span><span class="comment">// separating each group of four digit;,
|
||||
</span><span class="comment">// note that we're mixing a UTF-32 regex, with a UTF-16
|
||||
</span><span class="comment">// string and a UTF-8 format specifier, and it still all
|
||||
</span><span class="comment">// just works:
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">e</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span>
|
||||
<span class="string">"\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"</span><span class="special">);</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">human_format</span> <span class="special">=</span> <span class="string">"$1-$2-$3-$4"</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">UnicodeString</span> <span class="identifier">human_readable_card_number</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_replace</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">human_format</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode_types.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_iter.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,326 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Unicode Aware Regex Iterators</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../icu.html" title="Working With Unicode and ICU String Types">
|
||||
<link rel="prev" href="unicode_algo.html" title="Unicode Regular Expression Algorithms">
|
||||
<link rel="next" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode_algo.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter"></a><a href="unicode_iter.html" title="Unicode Aware Regex Iterators">
|
||||
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="id617067"></a>
|
||||
<a href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator">u32regex_iterator</a>
|
||||
</h5>
|
||||
<p>
|
||||
Type <code class="computeroutput"><span class="identifier">u32regex_iterator</span></code>
|
||||
is in all respects the same as <a href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> except that since
|
||||
the regular expression type is always <code class="computeroutput"><span class="identifier">u32regex</span></code>
|
||||
it only takes one template parameter (the iterator type). It also calls
|
||||
<code class="computeroutput"><span class="identifier">u32regex_search</span></code> internally,
|
||||
allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:
|
||||
</p>
|
||||
<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">u32regex_iterator</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// for members see regex_iterator
|
||||
</span><span class="special">};</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">utf8regex_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span> <span class="identifier">utf16regex_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar32</span><span class="special">*></span> <span class="identifier">utf32regex_iterator</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
In order to simplify the construction of a <code class="computeroutput"><span class="identifier">u32regex_iterator</span></code>
|
||||
from a string, there are a series of non-member helper functions called
|
||||
make_u32regex_iterator:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">Alloc</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">typename</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">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">make_u32regex_iterator</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">Alloc</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
Each of these overloads returns an iterator that enumerates all occurrences
|
||||
of expression <span class="emphasis"><em>e</em></span>, in text <span class="emphasis"><em>s</em></span>,
|
||||
using match_flags <span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<p>
|
||||
Example: search for international currency symbols, along with their
|
||||
associated numeric value:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">void</span> <span class="identifier">enumerate_currencies</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">text</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// enumerate and print all the currency symbols, along
|
||||
</span> <span class="comment">// with any associated numeric values:
|
||||
</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
|
||||
<span class="string">"([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"</span>
|
||||
<span class="string">"([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"</span>
|
||||
<span class="string">"(?(1)"</span>
|
||||
<span class="string">"|(?(2)"</span>
|
||||
<span class="string">"[[:Cf:][:Cc:][:Z*:]]*"</span>
|
||||
<span class="string">")"</span>
|
||||
<span class="string">"[[:Sc:]]"</span>
|
||||
<span class="string">")"</span><span class="special">;</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_iterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">r</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(*</span><span class="identifier">i</span><span class="special">)[</span><span class="number">0</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
Calling
|
||||
</p>
|
||||
<pre class="programlisting">enumerate_currencies(" $100.23 or £198.12 ");</pre>
|
||||
<p>
|
||||
Yields the output:
|
||||
</p>
|
||||
<pre class="programlisting">$100.23
|
||||
£198.12
|
||||
</pre>
|
||||
<p>
|
||||
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="id618820"></a>
|
||||
<a href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator">u32regex_token_iterator</a>
|
||||
</h5>
|
||||
<p>
|
||||
Type <code class="computeroutput"><span class="identifier">u32regex_token_iterator</span></code>
|
||||
is in all respects the same as <a href="../../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> except
|
||||
that since the regular expression type is always <code class="computeroutput"><span class="identifier">u32regex</span></code>
|
||||
it only takes one template parameter (the iterator type). It also calls
|
||||
<code class="computeroutput"><span class="identifier">u32regex_search</span></code> internally,
|
||||
allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:
|
||||
</p>
|
||||
<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">u32regex_token_iterator</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// for members see regex_token_iterator
|
||||
</span><span class="special">};</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">utf8regex_token_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span> <span class="identifier">utf16regex_token_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar32</span><span class="special">*></span> <span class="identifier">utf32regex_token_iterator</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
In order to simplify the construction of a <code class="computeroutput"><span class="identifier">u32regex_token_iterator</span></code>
|
||||
from a string, there are a series of non-member helper functions called
|
||||
<code class="computeroutput"><span class="identifier">make_u32regex_token_iterator</span></code>:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">Alloc</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</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">Alloc</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
Each of these overloads returns an iterator that enumerates all occurrences
|
||||
of marked sub-expression sub in regular expression <span class="emphasis"><em>e</em></span>,
|
||||
found in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<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">Alloc</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</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">Alloc</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
<p>
|
||||
Each of these overloads returns an iterator that enumerates one sub-expression
|
||||
for each submatch in regular expression <span class="emphasis"><em>e</em></span>, found
|
||||
in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">Alloc</span><span class="special">></span>
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</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">Alloc</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*></span>
|
||||
<span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
Each of these overloads returns an iterator that enumerates one sub-expression
|
||||
for each submatch in regular expression <span class="emphasis"><em>e</em></span>, found
|
||||
in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<p>
|
||||
Example: search for international currency symbols, along with their
|
||||
associated numeric value:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">void</span> <span class="identifier">enumerate_currencies2</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">text</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// enumerate and print all the currency symbols, along
|
||||
</span> <span class="comment">// with any associated numeric values:
|
||||
</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
|
||||
<span class="string">"([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"</span>
|
||||
<span class="string">"([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"</span>
|
||||
<span class="string">"(?(1)"</span>
|
||||
<span class="string">"|(?(2)"</span>
|
||||
<span class="string">"[[:Cf:][:Cc:][:Z*:]]*"</span>
|
||||
<span class="string">")"</span>
|
||||
<span class="string">"[[:Sc:]]"</span>
|
||||
<span class="string">")"</span><span class="special">;</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_token_iterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span>
|
||||
<span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="number">1</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="unicode_algo.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,136 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Unicode regular expression types</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../icu.html" title="Working With Unicode and ICU String Types">
|
||||
<link rel="prev" href="intro.html" title="Introduction to using Regex with ICU">
|
||||
<link rel="next" href="unicode_algo.html" title="Unicode Regular Expression Algorithms">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="intro.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_algo.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.icu.unicode_types"></a><a href="unicode_types.html" title="Unicode regular expression types">
|
||||
Unicode regular expression types</a></h5></div></div></div>
|
||||
<p>
|
||||
Header <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">icu</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> provides a regular expression traits
|
||||
class that handles UTF-32 characters:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">class</span> <span class="identifier">icu_regex_traits</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
and a regular expression type based upon that:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">UChar32</span><span class="special">,</span><span class="identifier">icu_regex_traits</span><span class="special">></span> <span class="identifier">u32regex</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
The type <code class="computeroutput"><span class="identifier">u32regex</span></code> is
|
||||
regular expression type to use for all Unicode regular expressions; internally
|
||||
it uses UTF-32 code points, but can be created from, and used to search,
|
||||
either UTF-8, or UTF-16 encoded strings as well as UTF-32 ones.
|
||||
</p>
|
||||
<p>
|
||||
The constructors, and assign member functions of <code class="computeroutput"><span class="identifier">u32regex</span></code>,
|
||||
require UTF-32 encoded strings, but there are a series of overloaded
|
||||
algorithms called <code class="computeroutput"><span class="identifier">make_u32regex</span></code>
|
||||
which allow regular expressions to be created from UTF-8, UTF-16, or
|
||||
UTF-32 encoded strings:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">InputIterator</span><span class="special">></span>
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">InputIterator</span> <span class="identifier">i</span><span class="special">,</span>
|
||||
<span class="identifier">InputIterator</span> <span class="identifier">j</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the iterator sequence [i,j). The character encoding of the
|
||||
sequence is determined based upon sizeof(*i): 1 implies UTF-8, 2 implies
|
||||
UTF-16, and 4 implies UTF-32.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the Null-terminated UTF-8 characater sequence <span class="emphasis"><em>p</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the Null-terminated UTF-8 characater sequence p.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the Null-terminated characater sequence p. The character
|
||||
encoding of the sequence is determined based upon sizeof(wchar_t): 1
|
||||
implies UTF-8, 2 implies UTF-16, and 4 implies UTF-32.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the Null-terminated UTF-16 characater sequence p.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</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">C</span><span class="special">,</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the string s. The character encoding of the string is determined
|
||||
based upon sizeof(C): 1 implies UTF-8, 2 implies UTF-16, and 4 implies
|
||||
UTF-32.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">u32regex</span> <span class="identifier">make_u32regex</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">opt</span>
|
||||
<span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">perl</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Creates a regular expression
|
||||
object from the UTF-16 encoding string s.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="intro.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="unicode_algo.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Using Boost Regex With MFC Strings</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../non_std_strings.html" title="Interfacing With Non-Standard String Types">
|
||||
<link rel="prev" href="icu/unicode_iter.html" title="Unicode Aware Regex Iterators">
|
||||
<link rel="next" href="mfc_strings/mfc_intro.html" title="Introduction to Boost.Regex and MFC Strings">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="icu/unicode_iter.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_strings/mfc_intro.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings"></a><a href="mfc_strings.html" title="Using Boost Regex With MFC Strings"> Using
|
||||
Boost Regex With MFC Strings</a></h4></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="mfc_strings/mfc_intro.html">
|
||||
Introduction to Boost.Regex and MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="mfc_strings/mfc_regex_types.html">
|
||||
Regex Types Used With MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="mfc_strings/mfc_regex_create.html">
|
||||
Regular Expression Creation From an MFC String</a></span></dt>
|
||||
<dt><span class="section"><a href="mfc_strings/mfc_algo.html">
|
||||
Overloaded Algorithms For MFC String Types</a></span></dt>
|
||||
<dt><span class="section"><a href="mfc_strings/mfc_iter.html">
|
||||
Iterating Over the Matches Within An MFC String</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="icu/unicode_iter.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../non_std_strings.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_strings/mfc_intro.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,233 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Overloaded Algorithms For MFC String Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="prev" href="mfc_regex_create.html" title="Regular Expression Creation From an MFC String">
|
||||
<link rel="next" href="mfc_iter.html" title="Iterating Over the Matches Within An MFC String">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_regex_create.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_iter.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo"></a><a href="mfc_algo.html" title="Overloaded Algorithms For MFC String Types">
|
||||
Overloaded Algorithms For MFC String Types</a></h5></div></div></div>
|
||||
<p>
|
||||
For each regular expression algorithm that's overloaded for a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span></code> argument, there is also
|
||||
one overloaded for the MFC/ATL string types. These algorithm signatures
|
||||
all look a lot more complex than they actually are, but for completeness
|
||||
here they are anyway:
|
||||
</p>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match"></a><h5>
|
||||
<a name="id623996"></a>
|
||||
<a href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match">regex_match</a>
|
||||
</h5>
|
||||
<p>
|
||||
There are two overloads, the first reports what matched in a match_results
|
||||
structure, the second does not.
|
||||
</p>
|
||||
<p>
|
||||
All the usual caveats for <a href="../../regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> apply, in particular
|
||||
the algorithm will only report a successful match if all of the input
|
||||
text matches the expression, if this isn't what you want then use <a href="../../regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>
|
||||
instead.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">B</span><span class="special">*,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">what</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span>
|
||||
<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">what</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Example:</strong></span>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Extract filename part of a path from a CString and return the result
|
||||
</span><span class="comment">// as another CString:
|
||||
</span><span class="comment">//
|
||||
</span><span class="identifier">CString</span> <span class="identifier">get_filename</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">path</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span><span class="identifier">__T</span><span class="special">(</span><span class="string">"(?:\\A|.*\\\\)([^\\\\]+)"</span><span class="special">));</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tmatch</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">path</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">r</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// extract $1 as a CString:
|
||||
</span> <span class="keyword">return</span> <span class="identifier">CString</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">1</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">length</span><span class="special">(</span><span class="number">1</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">(</span><span class="string">"Invalid pathname"</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<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="id624913"></a>
|
||||
<a href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match__second_overload_">regex_match
|
||||
(second overload)</a>
|
||||
</h5>
|
||||
<pre class="programlisting">
|
||||
<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">T</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">B</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Example:</strong></span>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Find out if *password* meets our password requirements,
|
||||
</span><span class="comment">// as defined by the regular expression *requirements*.
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">bool</span> <span class="identifier">is_valid_password</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">password</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">requirements</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">password</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_regex</span><span class="special">(</span><span class="identifier">requirements</span><span class="special">));</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search"></a><h5>
|
||||
<a name="id625509"></a>
|
||||
<a href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search">regex_search</a>
|
||||
</h5>
|
||||
<p>
|
||||
There are two additional overloads for <a href="../../regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, the first reports
|
||||
what matched the second does not:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">what</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns ::boost::regex_search(s.GetString(),
|
||||
s.GetString() + s.GetLength(), what, e, f);
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example</strong></span>: Postcode extraction from an
|
||||
address string.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">CString</span> <span class="identifier">extract_postcode</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">address</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// searches throw address for a UK postcode and returns the result,
|
||||
</span> <span class="comment">// the expression used is by Phil A. on www.regxlib.com:
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span><span class="identifier">__T</span><span class="special">(</span><span class="string">"^(([A-Z]{1,2}[0-9]{1,2})|([A-Z]{1,2}[0-9][A-Z]))\\s?([0-9][A-Z]{2})$"</span><span class="special">));</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tmatch</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">address</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">r</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// extract $0 as a CString:
|
||||
</span> <span class="keyword">return</span> <span class="identifier">CString</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">length</span><span class="special">());</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">(</span><span class="string">"No postcode found"</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<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="id626252"></a>
|
||||
<a href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search__second_overload_">regex_search
|
||||
(second overload)</a>
|
||||
</h5>
|
||||
<pre class="programlisting">
|
||||
<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">T</span><span class="special">></span>
|
||||
<span class="keyword">inline</span> <span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span>
|
||||
<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="id626660"></a>
|
||||
<a href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_replace">regex_replace</a>
|
||||
</h5>
|
||||
<p>
|
||||
There are two additional overloads for <a href="../../regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a>, the first sends
|
||||
output to an output iterator, while the second creates a new string
|
||||
</p>
|
||||
<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>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">out</span><span class="special">,</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">fmt</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span>
|
||||
<span class="identifier">flags</span><span class="special">);</span></code>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns a new string created
|
||||
using <a href="../../regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a>,
|
||||
and the same memory manager as string <span class="emphasis"><em>s</em></span>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example</strong></span>:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">//
|
||||
</span><span class="comment">// Take a credit card number as a string of digits,
|
||||
</span><span class="comment">// and reformat it as a human readable string with "-"
|
||||
</span><span class="comment">// separating each group of four digits:
|
||||
</span><span class="comment">//
|
||||
</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">e</span><span class="special">(</span><span class="identifier">__T</span><span class="special">(</span><span class="string">"\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"</span><span class="special">));</span>
|
||||
<span class="keyword">const</span> <span class="identifier">CString</span> <span class="identifier">human_format</span> <span class="special">=</span> <span class="identifier">__T</span><span class="special">(</span><span class="string">"$1-$2-$3-$4"</span><span class="special">);</span>
|
||||
|
||||
<span class="identifier">CString</span> <span class="identifier">human_readable_card_number</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">s</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">human_format</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_regex_create.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_iter.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,61 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Introduction to Boost.Regex and MFC Strings</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="prev" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="next" href="mfc_regex_types.html" title="Regex Types Used With MFC Strings">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_regex_types.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_intro"></a><a href="mfc_intro.html" title="Introduction to Boost.Regex and MFC Strings">
|
||||
Introduction to Boost.Regex and MFC Strings</a></h5></div></div></div>
|
||||
<p>
|
||||
The header <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">mfc</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> provides Boost.Regex support for
|
||||
MFC string types: note that this support requires Visual Studio .NET
|
||||
(Visual C++ 7) or later, where all of the MFC and ATL string types are
|
||||
based around the CSimpleStringT class template.
|
||||
</p>
|
||||
<p>
|
||||
In the following documentation, whenever you see CSimpleStringT<charT>,
|
||||
then you can substitute any of the following MFC/ATL types (all of which
|
||||
inherit from CSimpleStringT):
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">CString</span>
|
||||
<span class="identifier">CStringA</span>
|
||||
<span class="identifier">CStringW</span>
|
||||
<span class="identifier">CAtlString</span>
|
||||
<span class="identifier">CAtlStringA</span>
|
||||
<span class="identifier">CAtlStringW</span>
|
||||
<span class="identifier">CStringT</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">CFixedStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_regex_types.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,151 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Iterating Over the Matches Within An MFC String</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="prev" href="mfc_algo.html" title="Overloaded Algorithms For MFC String Types">
|
||||
<link rel="next" href="../../posix.html" title="POSIX Compatible C API's">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_algo.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../posix.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter"></a><a href="mfc_iter.html" title="Iterating Over the Matches Within An MFC String">
|
||||
Iterating Over the Matches Within An MFC String</a></h5></div></div></div>
|
||||
<p>
|
||||
The following helper functions are provided to ease the conversion from
|
||||
an MFC/ATL string to a <a href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a 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="id627747"></a>
|
||||
<a href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper">regex_iterator
|
||||
creation helper</a>
|
||||
</h5>
|
||||
<pre class="programlisting">
|
||||
<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">regex_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
|
||||
<span class="identifier">make_regex_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <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>
|
||||
<p>
|
||||
<span class="bold"><strong>Example</strong></span>:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">void</span> <span class="identifier">enumerate_links</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">html</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// enumerate and print all the links in some HTML text,
|
||||
</span> <span class="comment">// the expression used is by Andew Lee on www.regxlib.com:
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span>
|
||||
<span class="identifier">__T</span><span class="special">(</span><span class="string">"href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+"</span>
|
||||
<span class="string">"(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*"</span>
|
||||
<span class="string">"(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"</span><span class="special">));</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex_iterator</span> <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_regex_iterator</span><span class="special">(</span><span class="identifier">html</span><span class="special">,</span> <span class="identifier">r</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(*</span><span class="identifier">i</span><span class="special">)[</span><span class="number">1</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<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="id628501"></a>
|
||||
<a 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>
|
||||
<pre class="programlisting">
|
||||
<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">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
|
||||
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</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="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <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">sub</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">);</span></code>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
|
||||
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">subs</span><span class="special">,</span>
|
||||
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <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">subs</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">);</span></code>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
|
||||
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span> <span class="identifier">subs</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <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">subs</span><span class="special">,</span>
|
||||
<span class="identifier">f</span><span class="special">);</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example</strong></span>:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">void</span> <span class="identifier">enumerate_links2</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">html</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// enumerate and print all the links in some HTML text,
|
||||
</span> <span class="comment">// the expression used is by Andew Lee on www.regxlib.com:
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span>
|
||||
<span class="identifier">__T</span><span class="special">(</span><span class="string">"href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+"</span>
|
||||
<span class="string">"(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*"</span>
|
||||
<span class="string">"(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"</span><span class="special">));</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex_token_iterator</span> <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_regex_token_iterator</span><span class="special">(</span><span class="identifier">html</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="number">1</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_algo.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../posix.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Regular Expression Creation From an MFC String</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="prev" href="mfc_regex_types.html" title="Regex Types Used With MFC Strings">
|
||||
<link rel="next" href="mfc_algo.html" title="Overloaded Algorithms For MFC String Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_regex_types.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_algo.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_regex_create"></a><a href="mfc_regex_create.html" title="Regular Expression Creation From an MFC String">
|
||||
Regular Expression Creation From an MFC String</a></h5></div></div></div>
|
||||
<p>
|
||||
The following helper function is available to assist in the creation
|
||||
of a regular expression from an MFC/ATL string type:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span>
|
||||
<span class="identifier">make_regex</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">syntax_option_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">normal</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <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">f</span><span class="special">);</span></code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_regex_types.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_algo.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,54 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Regex Types Used With MFC Strings</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
|
||||
<link rel="prev" href="mfc_intro.html" title="Introduction to Boost.Regex and MFC Strings">
|
||||
<link rel="next" href="mfc_regex_create.html" title="Regular Expression Creation From an MFC String">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_intro.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_regex_create.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_regex_types"></a><a href="mfc_regex_types.html" title="Regex Types Used With MFC Strings">
|
||||
Regex Types Used With MFC Strings</a></h5></div></div></div>
|
||||
<p>
|
||||
The following typedefs are provided for the convenience of those working
|
||||
with TCHAR's:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">TCHAR</span><span class="special">></span> <span class="identifier">tregex</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">TCHAR</span> <span class="keyword">const</span><span class="special">*></span> <span class="identifier">tmatch</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_iterator</span><span class="special"><</span><span class="identifier">TCHAR</span> <span class="keyword">const</span><span class="special">*></span> <span class="identifier">tregex_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">TCHAR</span> <span class="keyword">const</span><span class="special">*></span> <span class="identifier">tregex_token_iterator</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
If you are working with explicitly narrow or wide characters rather than
|
||||
TCHAR, then use the regular Boost.Regex types <code class="computeroutput"><span class="identifier">regex</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">wregex</span></code> instead.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="mfc_intro.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mfc_regex_create.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,580 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>POSIX Compatible C API's</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="non_std_strings/mfc_strings/mfc_iter.html" title="Iterating Over the Matches Within An MFC String">
|
||||
<link rel="next" href="concepts.html" title="Concepts">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="non_std_strings/mfc_strings/mfc_iter.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="concepts.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.posix"></a><a href="posix.html" title="POSIX Compatible C API's"> POSIX Compatible C API's</a></h3></div></div></div>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/html/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
this is an abridged reference to the POSIX API functions, these are provided
|
||||
for compatibility with other libraries, rather than as an API to be used
|
||||
in new code (unless you need access from a language other than C++).
|
||||
This version of these functions should also happily coexist with other
|
||||
versions, as the names used are macros that expand to the actual function
|
||||
names.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cregex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
or:
|
||||
</p>
|
||||
<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">h</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
The following functions are available for users who need a POSIX compatible
|
||||
C library, they are available in both Unicode and narrow character versions,
|
||||
the standard POSIX API names are macros that expand to one version or the
|
||||
other depending upon whether UNICODE is defined or not.
|
||||
</p>
|
||||
<div class="important"><table border="0" summary="Important">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../../doc/html/images/important.png"></td>
|
||||
<th align="left">Important</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Note that all the symbols defined here are enclosed inside namespace
|
||||
<code class="computeroutput"><span class="identifier">boost</span></code> when used in C++
|
||||
programs, unless you use <code class="computeroutput"><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">h</span><span class="special">></span></code> instead - in which case the symbols
|
||||
are still defined in namespace boost, but are made available in the global
|
||||
namespace as well.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
The functions are defined as:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">extern</span> <span class="string">"C"</span> <span class="special">{</span>
|
||||
|
||||
<span class="keyword">struct</span> <span class="identifier">regex_tA</span><span class="special">;</span>
|
||||
<span class="keyword">struct</span> <span class="identifier">regex_tW</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">regcompA</span><span class="special">(</span><span class="identifier">regex_tA</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*,</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">regerrorA</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">regex_tA</span><span class="special">*,</span> <span class="keyword">char</span><span class="special">*,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">int</span> <span class="identifier">regexecA</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_tA</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">regmatch_t</span><span class="special">*,</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">void</span> <span class="identifier">regfreeA</span><span class="special">(</span><span class="identifier">regex_tA</span><span class="special">*);</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">regcompW</span><span class="special">(</span><span class="identifier">regex_tW</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*,</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">regerrorW</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">regex_tW</span><span class="special">*,</span> <span class="keyword">wchar_t</span><span class="special">*,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">int</span> <span class="identifier">regexecW</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_tW</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">regmatch_t</span><span class="special">*,</span> <span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="keyword">void</span> <span class="identifier">regfreeW</span><span class="special">(</span><span class="identifier">regex_tW</span><span class="special">*);</span>
|
||||
|
||||
<span class="preprocessor">#ifdef</span> <span class="identifier">UNICODE</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regcomp</span> <span class="identifier">regcompW</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regerror</span> <span class="identifier">regerrorW</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regexec</span> <span class="identifier">regexecW</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regfree</span> <span class="identifier">regfreeW</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regex_t</span> <span class="identifier">regex_tW</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regcomp</span> <span class="identifier">regcompA</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regerror</span> <span class="identifier">regerrorA</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regexec</span> <span class="identifier">regexecA</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regfree</span> <span class="identifier">regfreeA</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">regex_t</span> <span class="identifier">regex_tA</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
All the functions operate on structure regex_t, which exposes two public
|
||||
members:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Member
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span>
|
||||
<span class="identifier">re_nsub</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
This is filled in by <code class="computeroutput"><span class="identifier">regcomp</span></code>
|
||||
and indicates the number of sub-expressions contained in the regular
|
||||
expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">const</span> <span class="identifier">TCHAR</span><span class="special">*</span> <span class="identifier">re_endp</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Points to the end of the expression to compile when the flag REG_PEND
|
||||
is set.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/html/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">regex_t</span></code> is actually a
|
||||
<code class="computeroutput"><span class="preprocessor">#define</span></code> - it is either
|
||||
<code class="computeroutput"><span class="identifier">regex_tA</span></code> or <code class="computeroutput"><span class="identifier">regex_tW</span></code> depending upon whether <code class="computeroutput"><span class="identifier">UNICODE</span></code> is defined or not, <code class="computeroutput"><span class="identifier">TCHAR</span></code> is either <code class="computeroutput"><span class="keyword">char</span></code>
|
||||
or <code class="computeroutput"><span class="keyword">wchar_t</span></code> again depending
|
||||
upon the macro <code class="computeroutput"><span class="identifier">UNICODE</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
<a name="regcomp"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regcomp"></a><h5>
|
||||
<a name="id631442"></a>
|
||||
<a href="posix.html#boost_regex.ref.posix.regcomp">regcomp</a>
|
||||
</h5>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">regcomp</span></code> takes a pointer to
|
||||
a <code class="computeroutput"><span class="identifier">regex_t</span></code>, a pointer to the
|
||||
expression to compile and a flags parameter which can be a combination of:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Flag
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_EXTENDED
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Compiles modern regular expressions. Equivalent to <code class="computeroutput"><span class="identifier">regbase</span><span class="special">::</span><span class="identifier">char_classes</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">intervals</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">bk_refs</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_BASIC
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Compiles basic (obsolete) regular expression syntax. Equivalent to
|
||||
<code class="computeroutput"><span class="identifier">regbase</span><span class="special">::</span><span class="identifier">char_classes</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">intervals</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">limited_ops</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">bk_braces</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">bk_parens</span> <span class="special">|</span>
|
||||
<span class="identifier">regbase</span><span class="special">::</span><span class="identifier">bk_refs</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NOSPEC
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
All characters are ordinary, the expression is a literal string.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_ICASE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Compiles for matching that ignores character case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NOSUB
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Has no effect in this library.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NEWLINE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When this flag is set a dot does not match the newline character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_PEND
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When this flag is set the re_endp parameter of the regex_t structure
|
||||
must point to the end of the regular expression to compile.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NOCOLLATE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When this flag is set then locale dependent collation for character
|
||||
ranges is turned off.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_ESCAPE_IN_LISTS
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When this flag is set, then escape sequences are permitted in bracket
|
||||
expressions (character sets).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NEWLINE_ALT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When this flag is set then the newline character is equivalent to
|
||||
the alternation operator |.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_PERL
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Compiles Perl like regular expressions.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_AWK
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A shortcut for awk-like behavior: <code class="computeroutput"><span class="identifier">REG_EXTENDED</span>
|
||||
<span class="special">|</span> <span class="identifier">REG_ESCAPE_IN_LISTS</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_GREP
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A shortcut for grep like behavior: <code class="computeroutput"><span class="identifier">REG_BASIC</span>
|
||||
<span class="special">|</span> <span class="identifier">REG_NEWLINE_ALT</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_EGREP
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A shortcut for egrep like behavior: <code class="computeroutput"><span class="identifier">REG_EXTENDED</span>
|
||||
<span class="special">|</span> <span class="identifier">REG_NEWLINE_ALT</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="regerror"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regerror"></a><h5>
|
||||
<a name="id632085"></a>
|
||||
<a href="posix.html#boost_regex.ref.posix.regerror">regerror</a>
|
||||
</h5>
|
||||
<p>
|
||||
regerror takes the following parameters, it maps an error code to a human
|
||||
readable string:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Parameter
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
int code
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The error code.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
const regex_t* e
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The regular expression (can be null).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
char* buf
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The buffer to fill in with the error message.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
unsigned int buf_size
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The length of buf.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
If the error code is OR'ed with REG_ITOA then the message that results is
|
||||
the printable name of the code rather than a message, for example "REG_BADPAT".
|
||||
If the code is REG_ATIO then e must not be null and e->re_pend must point
|
||||
to the printable name of an error code, the return value is then the value
|
||||
of the error code. For any other value of code, the return value is the number
|
||||
of characters in the error message, if the return value is greater than or
|
||||
equal to buf_size then regerror will have to be called again with a larger
|
||||
buffer.
|
||||
</p>
|
||||
<a name="regexec"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regexec"></a><h5>
|
||||
<a name="id632268"></a>
|
||||
<a href="posix.html#boost_regex.ref.posix.regexec">regexec</a>
|
||||
</h5>
|
||||
<p>
|
||||
regexec finds the first occurrence of expression e within string buf. If
|
||||
len is non-zero then <span class="emphasis"><em>*m</em></span> is filled in with what matched
|
||||
the regular expression, m[0] contains what matched the whole string, m[1]
|
||||
the first sub-expression etc, see regmatch_t in the header file declaration
|
||||
for more details. The eflags parameter can be a combination of:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Flag
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Meaning
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NOTBOL
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Parameter buf does not represent the start of a line.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_NOTEOL
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Parameter buf does not terminate at the end of a line.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
REG_STARTEND
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The string searched starts at buf + pmatch[0].rm_so and ends at buf
|
||||
+ pmatch[0].rm_eo.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="regfree"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.ref.posix.regfree"></a><h5>
|
||||
<a name="id632410"></a>
|
||||
<a href="posix.html#boost_regex.ref.posix.regfree">regfree</a>
|
||||
</h5>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">regfree</span></code> frees all the memory
|
||||
that was allocated by regcomp.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="non_std_strings/mfc_strings/mfc_iter.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="concepts.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,559 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_iterator</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_replace.html" title="regex_replace">
|
||||
<link rel="next" href="regex_token_iterator.html" title="regex_token_iterator">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_replace.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_token_iterator.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_iterator"></a><a href="regex_iterator.html" title="regex_iterator"> regex_iterator</a></h3></div></div></div>
|
||||
<p>
|
||||
The iterator type <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> will enumerate all
|
||||
of the regular expression matches found in some sequence: dereferencing a
|
||||
<a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>
|
||||
yields a reference to a <a href="match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> object.
|
||||
</p>
|
||||
<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">charT</span> <span class="special">=</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">value_type</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">traits</span> <span class="special">=</span> <span class="identifier">regex_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">regex_iterator</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</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">regex_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">value_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <span class="identifier">pointer</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">reference</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">forward_iterator_tag</span> <span class="identifier">iterator_category</span><span class="special">;</span>
|
||||
|
||||
<a href="regex_iterator.html#boost_regex.regex_iterator.construct1">regex_iterator</a><span class="special">();</span>
|
||||
<a href="regex_iterator.html#boost_regex.regex_iterator.construct2">regex_iterator</a><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
<a href="regex_iterator.html#boost_regex.regex_iterator.construct3">regex_iterator</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&);</span>
|
||||
<span class="identifier">regex_iterator</span><span class="special">&</span> <a href="regex_iterator.html#boost_regex.regex_iterator.assign">operator=(</a><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&);</span>
|
||||
<span class="keyword">bool</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_eq">operator==</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">bool</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_ne">operator!=</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_deref">operator*</a><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_arrow">operator-></a><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">regex_iterator</span><span class="special">&</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_inc">operator++</a><span class="special">();</span>
|
||||
<span class="identifier">regex_iterator</span> <a href="regex_iterator.html#boost_regex.regex_iterator.op_inc2">operator++</a><span class="special">(</span><span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">cregex_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_iterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">sregex_iterator</span><span class="special">;</span>
|
||||
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_NO_WREGEX</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span> <span class="identifier">wcregex_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_iterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">wsregex_iterator</span><span class="special">;</span>
|
||||
<span class="preprocessor">#endif</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="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_iterator.html#boost_regex.regex_iterator.make">make_regex_iterator</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_iterator.html#boost_regex.regex_iterator.make">make_regex_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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="id590402"></a>
|
||||
<a href="regex_iterator.html#boost_regex.ref.regex_iterator.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
A <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>
|
||||
is constructed from a pair of iterators, and enumerates all occurrences of
|
||||
a regular expression within that iterator range.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.construct1"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs an end of sequence
|
||||
<a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.construct2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> that will enumerate
|
||||
all occurrences of the expression <span class="emphasis"><em>re</em></span>, within the sequence
|
||||
[a,b), and found using <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>m</em></span>.
|
||||
The object <span class="emphasis"><em>re</em></span> must exist for the lifetime of the <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.construct3"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a copy of <code class="computeroutput"><span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">==</span> <span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.assign"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: sets <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> equal to those in <code class="computeroutput"><span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: *this == that.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.op_eq"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&</span> <span class="identifier">that</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns true if *this is equal
|
||||
to that.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.op_ne"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="keyword">const</span> <span class="identifier">regex_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">!(*</span><span class="keyword">this</span> <span class="special">==</span> <span class="identifier">that</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.op_deref"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">*()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: dereferencing a <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> object it yields
|
||||
a const reference to a <a href="match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> object, whose members
|
||||
are set as follows:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Value
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">size</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">re</span><span class="special">.</span><span class="identifier">mark_count</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">empty</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">false</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The end of the last match found, or the start of the underlying sequence
|
||||
if this is the first match enumerated
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The same as the start of the match found: <code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
True if the prefix did not match an empty string: <code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span> <span class="special">!=</span>
|
||||
<span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The same as the end of the match found: <code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The end of the underlying sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
True if the suffix did not match an empty string: <code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span> <span class="special">!=</span>
|
||||
<span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The start of the sequence of characters that matched the regular
|
||||
expression
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The end of the sequence of characters that matched the regular expression
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if a full match was found, and false if it was a partial match
|
||||
(found as a result of the match_partial flag being set).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">size</span><span class="special">()</span></code>,
|
||||
the start of the sequence that matched sub-expression <span class="emphasis"><em>n</em></span>.
|
||||
Alternatively, if sub-expression <span class="emphasis"><em>n</em></span> did not participate
|
||||
in the match, then last.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">size</span><span class="special">()</span></code>,
|
||||
the end of the sequence that matched sub-expression <span class="emphasis"><em>n</em></span>.
|
||||
Alternatively, if sub-expression <span class="emphasis"><em>n</em></span> did not participate
|
||||
in the match, then last.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">)[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">size</span><span class="special">()</span></code>,
|
||||
true if sub-expression <span class="emphasis"><em>n</em></span> participated in the
|
||||
match, false otherwise.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">position</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="special">(*</span><span class="identifier">it</span><span class="special">).</span><span class="identifier">size</span><span class="special">()</span></code>,
|
||||
then the distance from the start of the underlying sequence to the
|
||||
start of sub-expression match <span class="emphasis"><em>n</em></span>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="boost_regex.regex_iterator.op_arrow"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">->()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">&(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.op_inc"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">++();</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: moves the iterator to the next
|
||||
match in the underlying sequence, or the end of sequence iterator if none
|
||||
if found. When the last match found matched a zero length string, then the
|
||||
<a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>
|
||||
will find the next match as follows: if there exists a non-zero length match
|
||||
that starts at the same location as the last one, then returns it, otherwise
|
||||
starts looking for the next (possibly zero length) match from one position
|
||||
to the right of the last match.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: *this.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.op_inc2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a copy result of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>, then
|
||||
calls <code class="computeroutput"><span class="special">++(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: result.
|
||||
</p>
|
||||
<a name="boost_regex.regex_iterator.make"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</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">make_regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_iterator</span><span class="special"><</span><span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</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">make_regex_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns an iterator that enumerates
|
||||
all occurences of expression <span class="emphasis"><em>e</em></span> in text <span class="emphasis"><em>p</em></span>
|
||||
using <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>
|
||||
<span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_iterator.examples"></a><h5>
|
||||
<a name="id593559"></a>
|
||||
<a href="regex_iterator.html#boost_regex.ref.regex_iterator.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following example takes a C++ source file and builds up an index of class
|
||||
names, and the location of that class in the file.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">std</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">difference_type</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
|
||||
<span class="comment">// possibly leading whitespace:
|
||||
</span> <span class="string">"^[[:space:]]*"</span>
|
||||
<span class="comment">// possible template declaration:
|
||||
</span> <span class="string">"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="comment">// class or struct:
|
||||
</span> <span class="string">"(class|struct)[[:space:]]*"</span>
|
||||
<span class="comment">// leading declspec macros etc:
|
||||
</span> <span class="string">"("</span>
|
||||
<span class="string">"\\<\\w+\\>"</span>
|
||||
<span class="string">"("</span>
|
||||
<span class="string">"[[:blank:]]*\\([^)]*\\)"</span>
|
||||
<span class="string">")?"</span>
|
||||
<span class="string">"[[:space:]]*"</span>
|
||||
<span class="string">")*"</span>
|
||||
<span class="comment">// the class name
|
||||
</span> <span class="string">"(\\<\\w*\\>)[[:space:]]*"</span>
|
||||
<span class="comment">// template specialisation parameters
|
||||
</span> <span class="string">"(<[^;:{]+>)?[[:space:]]*"</span>
|
||||
<span class="comment">// terminate in { or :
|
||||
</span> <span class="string">"(\\{|:[^;\\{()]*\\{)"</span><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
|
||||
<span class="identifier">map_type</span> <span class="identifier">class_index</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_callback</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">>&</span> <span class="identifier">what</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[5] contains the class name.
|
||||
</span> <span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span> <span class="comment">// add class name and position to map:
|
||||
</span> <span class="identifier">class_index</span><span class="special">[</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">str</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">str</span><span class="special">()]</span> <span class="special">=</span> <span class="identifier">what</span><span class="special">.</span><span class="identifier">position</span><span class="special">(</span><span class="number">5</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">load_file</span><span class="special">(</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">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">()-></span><span class="identifier">in_avail</span><span class="special">());</span>
|
||||
<span class="keyword">char</span> <span class="identifier">c</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">c</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">*</span> <span class="number">3</span><span class="special">);</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">append</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">**</span> <span class="identifier">argv</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">text</span><span class="special">;</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Processing file "</span> <span class="special"><<</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">fs</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
|
||||
<span class="identifier">load_file</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">fs</span><span class="special">);</span>
|
||||
<span class="comment">// construct our iterators:
|
||||
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_iterator</span> <span class="identifier">m1</span><span class="special">(</span><span class="identifier">text</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">text</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">expression</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_iterator</span> <span class="identifier">m2</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span><span class="special">,</span> <span class="special">&</span><span class="identifier">regex_callback</span><span class="special">);</span>
|
||||
<span class="comment">// copy results:
|
||||
</span> <span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">class_index</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" matches found"</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">map_type</span><span class="special">::</span><span class="identifier">iterator</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">d</span><span class="special">;</span>
|
||||
<span class="identifier">c</span> <span class="special">=</span> <span class="identifier">class_index</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">d</span> <span class="special">=</span> <span class="identifier">class_index</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">c</span> <span class="special">!=</span> <span class="identifier">d</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"class \""</span> <span class="special"><<</span> <span class="special">(*</span><span class="identifier">c</span><span class="special">).</span><span class="identifier">first</span> <span class="special"><<</span> <span class="string">"\" found at index: "</span> <span class="special"><<</span> <span class="special">(*</span><span class="identifier">c</span><span class="special">).</span><span class="identifier">second</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">++</span><span class="identifier">c</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="identifier">class_index</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">class_index</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">class_index</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_replace.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_token_iterator.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,424 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_match</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="sub_match.html" title="sub_match">
|
||||
<link rel="next" href="regex_search.html" title="regex_search">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sub_match.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_search.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_match"></a><a href="regex_match.html" title="regex_match"> regex_match</a></h3></div></div></div>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
The algorithm <a href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>
|
||||
determines whether a given regular expression matches <span class="bold"><strong>all</strong></span>
|
||||
of a given character sequence denoted by a pair of bidirectional-iterators,
|
||||
the algorithm is defined as follows, the main use of this function is data
|
||||
input validation.
|
||||
</p>
|
||||
<div class="important"><table border="0" summary="Important">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../../doc/html/images/important.png"></td>
|
||||
<th align="left">Important</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top">
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Note that the result is true only if the expression matches the <span class="bold"><strong>whole</strong></span> of the input sequence. If you want to search
|
||||
for an expression somewhere within the sequence then use <a href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>. If you want to
|
||||
match a prefix of the character string then use <a href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> with the flag match_continuous
|
||||
set.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table></div>
|
||||
<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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<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">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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="id573947"></a>
|
||||
<a 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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<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">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Requires</strong></span>: Type BidirectionalIterator meets
|
||||
the requirements of a Bidirectional Iterator (24.1.4).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Determines whether there is an
|
||||
exact match between the regular expression <span class="emphasis"><em>e</em></span>, and all
|
||||
of the character sequence [first, last), parameter <span class="emphasis"><em>flags</em></span>
|
||||
(see <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>)
|
||||
is used to control how the expression is matched against the character sequence.
|
||||
Returns true if such a match exists, false otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: If the function returns
|
||||
false, then the effect on parameter <span class="emphasis"><em>m</em></span> is undefined,
|
||||
otherwise the effects on parameter <span class="emphasis"><em>m</em></span> are given in the
|
||||
table:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Value
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">e</span><span class="special">.</span><span class="identifier">mark_count</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">empty</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">false</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">false</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">false</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if a full match was found, and false if it was a partial match
|
||||
(found as a result of the match_partial flag being set).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, the start of the sequence that
|
||||
matched sub-expression <span class="emphasis"><em>n</em></span>. Alternatively, if
|
||||
sub-expression <span class="emphasis"><em>n</em></span> did not participate in the
|
||||
match, then <code class="computeroutput"><span class="identifier">last</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, the end of the sequence that matched
|
||||
sub-expression <span class="emphasis"><em>n</em></span>. Alternatively, if sub-expression
|
||||
<span class="emphasis"><em>n</em></span> did not participate in the match, then <code class="computeroutput"><span class="identifier">last</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, true if sub-expression <span class="emphasis"><em>n</em></span>
|
||||
participated in the match, false otherwise.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Behaves "as if" by constructing
|
||||
an instance of <code class="computeroutput"><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">what</span></code>,
|
||||
and then returning the result of <code class="computeroutput"><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">what</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>
|
||||
<pre class="programlisting">
|
||||
<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">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">str</span><span class="special">,</span> <span class="identifier">str</span>
|
||||
<span class="special">+</span> <span class="identifier">char_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>::</span><span class="identifier">length</span><span class="special">(</span><span class="identifier">str</span><span class="special">),</span>
|
||||
<span class="identifier">m</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>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">m</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>
|
||||
<pre class="programlisting">
|
||||
<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">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">str</span><span class="special">,</span> <span class="identifier">str</span>
|
||||
<span class="special">+</span> <span class="identifier">char_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>::</span><span class="identifier">length</span><span class="special">(</span><span class="identifier">str</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>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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">bool</span> <span class="identifier">regex_match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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="id577134"></a>
|
||||
<a href="regex_match.html#boost_regex.ref.regex_match.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following example processes an ftp response:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">stdlib</span><span class="special">.</span><span class="identifier">h</span><span class="special">></span>
|
||||
<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>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">(</span><span class="string">"([0-9]+)(\\-| |$)(.*)"</span><span class="special">);</span>
|
||||
|
||||
<span class="comment">// process_ftp:
|
||||
</span><span class="comment">// on success returns the ftp response code, and fills
|
||||
</span><span class="comment">// msg with the ftp response message.
|
||||
</span><span class="keyword">int</span> <span class="identifier">process_ftp</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">response</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">*</span> <span class="identifier">msg</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">cmatch</span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">regex_match</span><span class="special">(</span><span class="identifier">response</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">expression</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[1] contains the response code
|
||||
</span> <span class="comment">// what[2] contains the separator character
|
||||
</span> <span class="comment">// what[3] contains the text message.
|
||||
</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">msg</span><span class="special">)</span>
|
||||
<span class="identifier">msg</span><span class="special">-></span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">3</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">3</span><span class="special">].</span><span class="identifier">second</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">atoi</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">1</span><span class="special">].</span><span class="identifier">first</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">// failure did not match
|
||||
</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">msg</span><span class="special">)</span>
|
||||
<span class="identifier">msg</span><span class="special">-></span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="sub_match.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_search.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,304 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_replace</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_search.html" title="regex_search">
|
||||
<link rel="next" href="regex_iterator.html" title="regex_iterator">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_search.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_iterator.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_replace"></a><a href="regex_replace.html" title="regex_replace"> regex_replace</a></h3></div></div></div>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
The algorithm <a href="regex_replace.html" title="regex_replace"><code class="computeroutput"><span class="identifier">regex_replace</span></code></a> searches through a
|
||||
string finding all the matches to the regular expression: for each match
|
||||
it then calls <a href="match_results.html#boost_regex.match_results_format"><code class="computeroutput"><span class="identifier">match_results</span><span class="special"><>::</span><span class="identifier">format</span></code></a> to format the string and
|
||||
sends the result to the output iterator. Sections of text that do not match
|
||||
are copied to the output unchanged only if the <span class="emphasis"><em>flags</em></span>
|
||||
parameter does not have the flag <code class="computeroutput"><span class="identifier">format_no_copy</span></code>
|
||||
set. If the flag <code class="computeroutput"><span class="identifier">format_first_only</span></code>
|
||||
is set then only the first occurrence is replaced rather than all occurrences.
|
||||
</p>
|
||||
<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>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">charT</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">regex_replace</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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="id584462"></a>
|
||||
<a 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>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
Enumerates all the occurences of expression <span class="emphasis"><em>e</em></span> in the
|
||||
sequence [first, last), replacing each occurence with the string that results
|
||||
by merging the match found with the format string <span class="emphasis"><em>fmt</em></span>,
|
||||
and copies the resulting string to <span class="emphasis"><em>out</em></span>.
|
||||
</p>
|
||||
<p>
|
||||
If the flag <code class="computeroutput"><span class="identifier">format_no_copy</span></code>
|
||||
is set in <span class="emphasis"><em>flags</em></span> then unmatched sections of text are
|
||||
not copied to output.
|
||||
</p>
|
||||
<p>
|
||||
If the flag <code class="computeroutput"><span class="identifier">format_first_only</span></code>
|
||||
is set in flags then only the first occurence of <span class="emphasis"><em>e</em></span> is
|
||||
replaced.
|
||||
</p>
|
||||
<p>
|
||||
The manner in which the format string <span class="emphasis"><em>fmt</em></span> is interpretted,
|
||||
along with the rules used for finding matches, are determined by the flags
|
||||
set in <span class="emphasis"><em>flags</em></span>: see <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Constructs an <a href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> object:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_iterator</span><span class="special"><</span><span class="identifier">BidirectionalIterator</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">Allocator</span><span class="special">></span>
|
||||
<span class="identifier">i</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">),</span>
|
||||
</pre>
|
||||
<p>
|
||||
and uses <span class="emphasis"><em>i</em></span> to enumerate through all of the matches
|
||||
<span class="emphasis"><em>m</em></span> of type <a href="match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> <code class="computeroutput"><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span></code>
|
||||
that occur within the sequence [first, last).
|
||||
</p>
|
||||
<p>
|
||||
If no such matches are found and
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="special">!(</span><span class="identifier">flags</span> <span class="special">&</span> <span class="identifier">format_no_copy</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
then calls
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">out</span><span class="special">).</span>
|
||||
</pre>
|
||||
<p>
|
||||
Otherwise, for each match found, if
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="special">!(</span><span class="identifier">flags</span> <span class="special">&</span> <span class="identifier">format_no_copy</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
calls
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">last</span><span class="special">,</span> <span class="identifier">out</span><span class="special">),</span>
|
||||
</pre>
|
||||
<p>
|
||||
and then calls
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">m</span><span class="special">.</span><span class="identifier">format</span><span class="special">(</span><span class="identifier">out</span><span class="special">,</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">).</span>
|
||||
</pre>
|
||||
<p>
|
||||
Finally if
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="special">!(</span><span class="identifier">flags</span> <span class="special">&</span> <span class="identifier">format_no_copy</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
calls
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">last_m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last_m</span><span class="special">,</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">last</span><span class="special">,</span> <span class="identifier">out</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
where <span class="emphasis"><em>last_m</em></span> is a copy of the last match found.
|
||||
</p>
|
||||
<p>
|
||||
If <code class="computeroutput"><span class="identifier">flags</span> <span class="special">&</span>
|
||||
<span class="identifier">format_first_only</span></code> is non-zero then
|
||||
only the first match found is replaced.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: out.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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">charT</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">regex_replace</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">fmt</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Constructs an object <code class="computeroutput"><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="identifier">result</span></code>, calls <code class="computeroutput"><span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">result</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">fmt</span><span class="special">,</span>
|
||||
<span class="identifier">flags</span><span class="special">)</span></code>,
|
||||
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="id586023"></a>
|
||||
<a href="regex_replace.html#boost_regex.ref.regex_replace.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following example takes C/C++ source code as input, and outputs syntax
|
||||
highlighted HTML code.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">sstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iterator</span><span class="special">></span>
|
||||
<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>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file and transform to
|
||||
</span><span class="comment">// syntax highlighted code in html format
|
||||
</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e1</span><span class="special">,</span> <span class="identifier">e2</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">expression_text</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">format_string</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">pre_expression</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">pre_format</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">header_text</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">footer_text</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">load_file</span><span class="special">(</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">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">()-></span><span class="identifier">in_avail</span><span class="special">());</span>
|
||||
<span class="keyword">char</span> <span class="identifier">c</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">c</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">*</span> <span class="number">3</span><span class="special">);</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">append</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">**</span> <span class="identifier">argv</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">try</span><span class="special">{</span>
|
||||
<span class="identifier">e1</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">expression_text</span><span class="special">);</span>
|
||||
<span class="identifier">e2</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">pre_expression</span><span class="special">);</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Processing file "</span> <span class="special"><<</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">fs</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">in</span><span class="special">;</span>
|
||||
<span class="identifier">load_file</span><span class="special">(</span><span class="identifier">in</span><span class="special">,</span> <span class="identifier">fs</span><span class="special">);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">out_name</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">])</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="string">".htm"</span><span class="special">));</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ofstream</span> <span class="identifier">os</span><span class="special">(</span><span class="identifier">out_name</span><span class="special">.</span><span class="identifier">c_str</span><span class="special">());</span>
|
||||
<span class="identifier">os</span> <span class="special"><<</span> <span class="identifier">header_text</span><span class="special">;</span>
|
||||
<span class="comment">// strip '<' and '>' first by outputting to a
|
||||
</span> <span class="comment">// temporary string stream
|
||||
</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostringstream</span> <span class="identifier">t</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios</span><span class="special">::</span><span class="identifier">out</span> <span class="special">|</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios</span><span class="special">::</span><span class="identifier">binary</span><span class="special">);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">oi</span><span class="special">(</span><span class="identifier">t</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">oi</span><span class="special">,</span> <span class="identifier">in</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">in</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
|
||||
<span class="identifier">e2</span><span class="special">,</span> <span class="identifier">pre_format</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">format_all</span><span class="special">);</span>
|
||||
<span class="comment">// then output to final output stream
|
||||
</span> <span class="comment">// adding syntax highlighting:
|
||||
</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">(</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">str</span><span class="special">());</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">out</span><span class="special">(</span><span class="identifier">os</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_replace</span><span class="special">(</span><span class="identifier">out</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">e1</span><span class="special">,</span> <span class="identifier">format_string</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">format_all</span><span class="special">);</span>
|
||||
<span class="identifier">os</span> <span class="special"><<</span> <span class="identifier">footer_text</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">catch</span><span class="special">(...)</span>
|
||||
<span class="special">{</span> <span class="keyword">return</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span> <span class="special">}</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">pre_expression</span> <span class="special">=</span> <span class="string">"(<)|(>)|(&)|\\r"</span><span class="special">;</span>
|
||||
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">pre_format</span> <span class="special">=</span> <span class="string">"(?1<)(?2>)(?3&amp;)"</span><span class="special">;</span>
|
||||
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">expression_text</span> <span class="special">=</span>
|
||||
<span class="comment">// preprocessor directives: index 1
|
||||
</span> <span class="string">"(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|"</span>
|
||||
<span class="comment">// comment: index 2
|
||||
</span> <span class="string">"(//[^\\n]*|/\\*.*?\\*/)|"</span>
|
||||
<span class="comment">// literals: index 3
|
||||
</span> <span class="string">"\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+"</span>
|
||||
<span class="string">"(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"</span>
|
||||
<span class="comment">// string literals: index 4
|
||||
</span> <span class="string">"('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"</span>
|
||||
<span class="comment">// keywords: index 5
|
||||
</span> <span class="string">"\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"</span>
|
||||
<span class="string">"|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"</span>
|
||||
<span class="string">"|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"</span>
|
||||
<span class="string">"|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"</span>
|
||||
<span class="string">"|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"</span>
|
||||
<span class="string">"|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"</span>
|
||||
<span class="string">"|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"</span>
|
||||
<span class="string">"|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"</span>
|
||||
<span class="string">"|using|virtual|void|volatile|wchar_t|while)\\>"</span>
|
||||
<span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">format_string</span> <span class="special">=</span> <span class="string">"(?1<font color=\"#008040\">$&</font>)"</span>
|
||||
<span class="string">"(?2<I><font color=\"#000080\">$&</font></I>)"</span>
|
||||
<span class="string">"(?3<font color=\"#0000A0\">$&</font>)"</span>
|
||||
<span class="string">"(?4<font color=\"#0000FF\">$&</font>)"</span>
|
||||
<span class="string">"(?5<B>$&</B>)"</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">header_text</span> <span class="special">=</span>
|
||||
<span class="string">"<HTML>\n<HEAD>\n"</span>
|
||||
<span class="string">"<TITLE>Auto-generated html formated source</TITLE>\n"</span>
|
||||
<span class="string">"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"</span>
|
||||
<span class="string">"</HEAD>\n"</span>
|
||||
<span class="string">"<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n"</span>
|
||||
<span class="string">"<P> </P>\n<PRE>"</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">footer_text</span> <span class="special">=</span> <span class="string">"</PRE>\n</BODY>\n\n"</span><span class="special">;</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_search.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_iterator.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,427 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_search</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_match.html" title="regex_match">
|
||||
<link rel="next" href="regex_replace.html" title="regex_replace">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_match.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_replace.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_search"></a><a href="regex_search.html" title="regex_search"> regex_search</a></h3></div></div></div>
|
||||
<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>
|
||||
</pre>
|
||||
<p>
|
||||
The algorithm <a href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> will search a range
|
||||
denoted by a pair of bidirectional-iterators for a given regular expression.
|
||||
The algorithm uses various heuristics to reduce the search time by only checking
|
||||
for a match if a match could conceivably start at that position. The algorithm
|
||||
is defined as follows:
|
||||
</p>
|
||||
<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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<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">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span>
|
||||
<span class="keyword">typename</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span><span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span>
|
||||
<span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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="id579354"></a>
|
||||
<a 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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">BidirectionalIterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<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">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Requires</strong></span>: Type BidirectionalIterator meets
|
||||
the requirements of a Bidirectional Iterator (24.1.4).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Determines whether there is some
|
||||
sub-sequence within [first,last) that matches the regular expression <span class="emphasis"><em>e</em></span>,
|
||||
parameter <span class="emphasis"><em>flags</em></span> is used to control how the expression
|
||||
is matched against the character sequence. Returns true if such a sequence
|
||||
exists, false otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: If the function returns
|
||||
false, then the effect on parameter <span class="emphasis"><em>m</em></span> is undefined,
|
||||
otherwise the effects on parameter <span class="emphasis"><em>m</em></span> are given in the
|
||||
table:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Value
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">e</span><span class="special">.</span><span class="identifier">mark_count</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">empty</span><span class="special">()</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="keyword">false</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">first</span> <span class="special">!=</span>
|
||||
<span class="identifier">m</span><span class="special">.</span><span class="identifier">prefix</span><span class="special">().</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">last</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">first</span> <span class="special">!=</span>
|
||||
<span class="identifier">m</span><span class="special">.</span><span class="identifier">suffix</span><span class="special">().</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The start of the sequence of characters that matched the regular
|
||||
expression
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The end of the sequence of characters that matched the regular expression
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
true if a full match was found, and false if it was a partial match
|
||||
(found as a result of the match_partial flag being set).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">first</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, the start of the sequence that
|
||||
matched sub-expression <span class="emphasis"><em>n</em></span>. Alternatively, if
|
||||
sub-expression <span class="emphasis"><em>n</em></span> did not participate in the
|
||||
match, then last.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">second</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, the end of the sequence that matched
|
||||
sub-expression <span class="emphasis"><em>n</em></span>. Alternatively, if sub-expression
|
||||
<span class="emphasis"><em>n</em></span> did not participate in the match, then <code class="computeroutput"><span class="identifier">last</span></code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">m</span><span class="special">[</span><span class="identifier">n</span><span class="special">].</span><span class="identifier">matched</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
For all integers <code class="computeroutput"><span class="identifier">n</span> <span class="special"><</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>, true if sub-expression <span class="emphasis"><em>n</em></span>
|
||||
participated in the match, false otherwise.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<pre class="programlisting">
|
||||
<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">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span><span class="special">,</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">str</span><span class="special">,</span> <span class="identifier">str</span>
|
||||
<span class="special">+</span> <span class="identifier">char_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>::</span><span class="identifier">length</span><span class="special">(</span><span class="identifier">str</span><span class="special">),</span>
|
||||
<span class="identifier">m</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>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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>
|
||||
<span class="keyword">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="identifier">match_results</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">m</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>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">iterator</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">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="identifier">last</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Behaves "as if" by constructing
|
||||
an instance of <code class="computeroutput"><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">what</span></code>,
|
||||
and then returning the result of <code class="computeroutput"><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">what</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>
|
||||
<pre class="programlisting">
|
||||
<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">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">str</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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">str</span><span class="special">,</span> <span class="identifier">str</span>
|
||||
<span class="special">+</span> <span class="identifier">char_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>::</span><span class="identifier">length</span><span class="special">(</span><span class="identifier">str</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>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</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">bool</span> <span class="identifier">regex_search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<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="id582627"></a>
|
||||
<a href="regex_search.html#boost_regex.ref.regex_search.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following example, takes the contents of a file in the form of a string,
|
||||
and searches for all the C++ class declarations in the file. The code will
|
||||
work regardless of the way that <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
|
||||
is implemented, for example it could easily be modified to work with the
|
||||
SGI rope class, which uses a non-contiguous storage strategy.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">map</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="comment">// purpose:
|
||||
</span><span class="comment">// takes the contents of a file in the form of a string
|
||||
</span><span class="comment">// and searches for all the C++ class definitions, storing
|
||||
</span><span class="comment">// their locations in a map of strings/int's
|
||||
</span><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span> <span class="special">></span> <span class="identifier">map_type</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">expression</span><span class="special">(</span>
|
||||
<span class="string">"^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</span>
|
||||
<span class="string">"(class|struct)[[:space:]]*"</span>
|
||||
<span class="string">"(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"</span>
|
||||
<span class="string">"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*"</span>
|
||||
<span class="string">"(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">IndexClasses</span><span class="special">(</span><span class="identifier">map_type</span><span class="special">&</span> <span class="identifier">m</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">file</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">;</span>
|
||||
<span class="identifier">start</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="identifier">end</span> <span class="special">=</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">what</span><span class="special">;</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">regex_search</span><span class="special">(</span><span class="identifier">start</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">what</span><span class="special">,</span> <span class="identifier">expression</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// what[0] contains the whole string
|
||||
</span> <span class="comment">// what[5] contains the class name.
|
||||
</span> <span class="comment">// what[6] contains the template specialisation if any.
|
||||
</span> <span class="comment">// add class name and position to map:
|
||||
</span> <span class="identifier">m</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">second</span><span class="special">)</span>
|
||||
<span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">what</span><span class="special">[</span><span class="number">6</span><span class="special">].</span><span class="identifier">second</span><span class="special">)]</span>
|
||||
<span class="special">=</span> <span class="identifier">what</span><span class="special">[</span><span class="number">5</span><span class="special">].</span><span class="identifier">first</span> <span class="special">-</span> <span class="identifier">file</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
|
||||
<span class="comment">// update search position:
|
||||
</span> <span class="identifier">start</span> <span class="special">=</span> <span class="identifier">what</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">second</span><span class="special">;</span>
|
||||
<span class="comment">// update flags:
|
||||
</span> <span class="identifier">flags</span> <span class="special">|=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_prev_avail</span><span class="special">;</span>
|
||||
<span class="identifier">flags</span> <span class="special">|=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_not_bob</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_match.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="regex_replace.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,521 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_token_iterator</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="regex_iterator.html" title="regex_iterator">
|
||||
<link rel="next" href="bad_expression.html" title="bad_expression">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_iterator.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bad_expression.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_token_iterator"></a><a href="regex_token_iterator.html" title="regex_token_iterator"> regex_token_iterator</a></h3></div></div></div>
|
||||
<p>
|
||||
The template class <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> is an iterator
|
||||
adapter; that is to say it represents a new view of an existing iterator
|
||||
sequence, by enumerating all the occurrences of a regular expression within
|
||||
that sequence, and presenting one or more character sequence for each match
|
||||
found. Each position enumerated by the iterator is a <a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> object that represents
|
||||
what matched a particular sub-expression within the regular expression. When
|
||||
class <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> is used to
|
||||
enumerate a single sub-expression with index -1, then the iterator performs
|
||||
field splitting: that is to say it enumerates one character sequence for
|
||||
each section of the character container sequence that does not match the
|
||||
regular expression specified.
|
||||
</p>
|
||||
<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">charT</span> <span class="special">=</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">value_type</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">traits</span> <span class="special">=</span> <span class="identifier">regex_traits</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">regex_token_iterator</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">basic_regex</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">regex_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">value_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <span class="identifier">pointer</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">reference</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">forward_iterator_tag</span> <span class="identifier">iterator_category</span><span class="special">;</span>
|
||||
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.construct1">regex_token_iterator</a><span class="special">();</span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.construct2">regex_token_iterator</a><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.construct3">regex_token_iterator</a><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatches</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.construct4">regex_token_iterator</a><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatches</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.construct5">regex_token_iterator</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&);</span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">&</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.assign">operator=</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&);</span>
|
||||
<span class="keyword">bool</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_eq">operator==</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">bool</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_ne">operator!=</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_deref">operator*</a><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_arrow">operator-></a><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">&</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_inc1">operator++</a><span class="special">();</span>
|
||||
<span class="identifier">regex_token_iterator</span> <a href="regex_token_iterator.html#boost_regex.regex_token_iterator.op_inc2">operator++</a><span class="special">(</span><span class="keyword">int</span><span class="special">);</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">cregex_token_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">sregex_token_iterator</span><span class="special">;</span>
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_NO_WREGEX</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span> <span class="identifier">wcregex_token_iterator</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">regex_token_iterator</span><span class="special"><<</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">wsregex_token_iterator</span><span class="special">;</span>
|
||||
<span class="preprocessor">#endif</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="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</a><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</a><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<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="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</a><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span>
|
||||
<span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">></span>
|
||||
<a href="regex_token_iterator.html#boost_regex.regex_token_iterator.make">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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="id599391"></a>
|
||||
<a 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>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">();</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs an end of sequence iterator.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.construct2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Preconditions</strong></span>: <code class="computeroutput"><span class="special">!</span><span class="identifier">re</span><span class="special">.</span><span class="identifier">empty</span><span class="special">()</span></code>. Object <span class="emphasis"><em>re</em></span> shall exist
|
||||
for the lifetime of the iterator constructed from it.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> that will enumerate
|
||||
one string for each regular expression match of the expression <span class="emphasis"><em>re</em></span>
|
||||
found within the sequence [a,b), using match flags <span class="emphasis"><em>m</em></span>
|
||||
(see <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>).
|
||||
The string enumerated is the sub-expression <span class="emphasis"><em>submatch</em></span>
|
||||
for each match found; if <span class="emphasis"><em>submatch</em></span> is -1, then enumerates
|
||||
all the text sequences that did not match the expression <span class="emphasis"><em>re</em></span>
|
||||
(that is to performs field splitting).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.construct3"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatches</span><span class="special">,</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Preconditions</strong></span>: <code class="computeroutput"><span class="identifier">submatches</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span>
|
||||
<span class="special">&&</span> <span class="special">!</span><span class="identifier">re</span><span class="special">.</span><span class="identifier">empty</span><span class="special">()</span></code>. Object <span class="emphasis"><em>re</em></span> shall exist
|
||||
for the lifetime of the iterator constructed from it.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> that will enumerate
|
||||
<code class="computeroutput"><span class="identifier">submatches</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span></code>
|
||||
strings for each regular expression match of the expression <span class="emphasis"><em>re</em></span>
|
||||
found within the sequence [a,b), using match flags <span class="emphasis"><em>m</em></span>
|
||||
(see <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>).
|
||||
For each match found one string will be enumerated for each sub-expression
|
||||
index contained within submatches vector; if <code class="computeroutput"><span class="identifier">submatches</span><span class="special">[</span><span class="number">0</span><span class="special">]</span></code>
|
||||
is -1, then the first string enumerated for each match will be all of the
|
||||
text from end of the last match to the start of the current match, in addition
|
||||
there will be one extra string enumerated when no more matches can be found:
|
||||
from the end of the last match found, to the end of the underlying sequence.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.construct4"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">BidirectionalIterator</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="identifier">BidirectionalIterator</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">regex_type</span><span class="special">&</span> <span class="identifier">re</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatches</span><span class="special">)[</span><span class="identifier">R</span><span class="special">],</span>
|
||||
<span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Preconditions</strong></span>: <code class="computeroutput"><span class="special">!</span><span class="identifier">re</span><span class="special">.</span><span class="identifier">empty</span><span class="special">()</span></code>. Object <span class="emphasis"><em>re</em></span> shall exist
|
||||
for the lifetime of the iterator constructed from it.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> that will enumerate
|
||||
<span class="emphasis"><em>R</em></span> strings for each regular expression match of the expression
|
||||
<span class="emphasis"><em>re</em></span> found within the sequence [a,b), using match flags
|
||||
<span class="emphasis"><em>m</em></span> (see <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>). For each match
|
||||
found one string will be enumerated for each sub-expression index contained
|
||||
within the <span class="emphasis"><em>submatches</em></span> array; if <code class="computeroutput"><span class="identifier">submatches</span><span class="special">[</span><span class="number">0</span><span class="special">]</span></code>
|
||||
is -1, then the first string enumerated for each match will be all of the
|
||||
text from end of the last match to the start of the current match, in addition
|
||||
there will be one extra string enumerated when no more matches can be found:
|
||||
from the end of the last match found, to the end of the underlying sequence.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.construct5"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a copy of <code class="computeroutput"><span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">==</span> <span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.assign"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: sets <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> to be equal to <code class="computeroutput"><span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Postconditions</strong></span>: <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">==</span> <span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_eq"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns true if <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> is the same position as <code class="computeroutput"><span class="identifier">that</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_ne"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="keyword">const</span> <span class="identifier">regex_token_iterator</span><span class="special">&)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">!(*</span><span class="keyword">this</span> <span class="special">==</span> <span class="identifier">that</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_deref"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="keyword">operator</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 current character sequence
|
||||
being enumerated.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_arrow"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">->()</span><span class="keyword">const</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="special">&(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_inc1"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">++();</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: Moves on to the next character
|
||||
sequence to be enumerated.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Throws</strong></span>: <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
|
||||
if the complexity of matching the expression against an N character string
|
||||
begins to exceed O(N<sup>2</sup>), or if the program runs out of stack space while matching
|
||||
the expression (if Boost.Regex is configured in recursive mode), or if the
|
||||
matcher exhausts it's permitted memory allocation (if Boost.Regex is configured
|
||||
in non-recursive mode).
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.op_inc2"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">regex_token_iterator</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: constructs a copy result of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>, then
|
||||
calls <code class="computeroutput"><span class="special">++(*</span><span class="keyword">this</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: result.
|
||||
</p>
|
||||
<a name="boost_regex.regex_token_iterator.make"></a><p>
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<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="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</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">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</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">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">int</span> <span class="identifier">submatch</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</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">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span>
|
||||
<span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</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">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
|
||||
<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>
|
||||
|
||||
<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="identifier">regex_token_iterator</span><span class="special"><</span><span class="keyword">const</span> <span class="identifier">charT</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">make_regex_token_iterator</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
|
||||
<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">ST</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SA</span><span class="special">></span>
|
||||
<span class="identifier">regex_token_iterator</span><span class="special"><</span>
|
||||
<span class="keyword">typename</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>::</span><span class="identifier">const_iterator</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">make_regex_token_iterator</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">ST</span><span class="special">,</span> <span class="identifier">SA</span><span class="special">>&</span> <span class="identifier">p</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">basic_regex</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">e</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">submatch</span><span class="special">,</span>
|
||||
<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>
|
||||
<p>
|
||||
<span class="bold"><strong>Effects</strong></span>: returns a <a href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> that enumerates
|
||||
one <a href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>
|
||||
for each value in <span class="emphasis"><em>submatch</em></span> for each occurrence of regular
|
||||
expression <span class="emphasis"><em>e</em></span> in string <span class="emphasis"><em>p</em></span>, matched
|
||||
using <a href="match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>
|
||||
<span class="emphasis"><em>m</em></span>.
|
||||
</p>
|
||||
<a name="boost_regex.ref.regex_token_iterator.examples"></a><h5>
|
||||
<a name="id603638"></a>
|
||||
<a href="regex_token_iterator.html#boost_regex.ref.regex_token_iterator.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
The following example takes a string and splits it into a series of tokens:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">std</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">string</span> <span class="identifier">s</span><span class="special">;</span>
|
||||
<span class="keyword">do</span><span class="special">{</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">argc</span> <span class="special">==</span> <span class="number">1</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Enter text to split (or \"quit\" to exit): "</span><span class="special">;</span>
|
||||
<span class="identifier">getline</span><span class="special">(</span><span class="identifier">cin</span><span class="special">,</span> <span class="identifier">s</span><span class="special">);</span>
|
||||
<span class="keyword">if</span><span class="special">(</span><span class="identifier">s</span> <span class="special">==</span> <span class="string">"quit"</span><span class="special">)</span> <span class="keyword">break</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="identifier">s</span> <span class="special">=</span> <span class="string">"This is a string of tokens"</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">re</span><span class="special">(</span><span class="string">"\\s+"</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">i</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">re</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">unsigned</span> <span class="identifier">count</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">++</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">count</span><span class="special">++;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"There were "</span> <span class="special"><<</span> <span class="identifier">count</span> <span class="special"><<</span> <span class="string">" tokens found."</span> <span class="special"><<</span> <span class="identifier">endl</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span><span class="keyword">while</span><span class="special">(</span><span class="identifier">argc</span> <span class="special">==</span> <span class="number">1</span><span class="special">);</span>
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
The following example takes a html file and outputs a list of all the linked
|
||||
files:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">fstream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iterator</span><span class="special">></span>
|
||||
<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>
|
||||
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\""</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">normal</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regbase</span><span class="special">::</span><span class="identifier">icase</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">void</span> <span class="identifier">load_file</span><span class="special">(</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">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// attempt to grow string buffer to match file size,
|
||||
</span> <span class="comment">// this doesn't always work...
|
||||
</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">rdbuf</span><span class="special">()-></span><span class="identifier">in_avail</span><span class="special">());</span>
|
||||
<span class="keyword">char</span> <span class="identifier">c</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">is</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">c</span><span class="special">))</span>
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// use logarithmic growth stategy, in case
|
||||
</span> <span class="comment">// in_avail (above) returned zero:
|
||||
</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">*</span> <span class="number">3</span><span class="special">);</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">append</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">**</span> <span class="identifier">argv</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">;</span>
|
||||
<span class="keyword">int</span> <span class="identifier">i</span><span class="special">;</span>
|
||||
<span class="keyword">for</span><span class="special">(</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Findings URL's in "</span> <span class="special"><<</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="string">":"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">is</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
|
||||
<span class="identifier">load_file</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">is</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">i</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="number">1</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">++</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// alternative method:
|
||||
</span> <span class="comment">// test the array-literal constructor, and split out the whole
|
||||
</span> <span class="comment">// match as well as $1....
|
||||
</span> <span class="comment">//
|
||||
</span> <span class="keyword">for</span><span class="special">(</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Findings URL's in "</span> <span class="special"><<</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="string">":"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">s</span><span class="special">.</span><span class="identifier">erase</span><span class="special">();</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">is</span><span class="special">(</span><span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">]);</span>
|
||||
<span class="identifier">load_file</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">is</span><span class="special">);</span>
|
||||
<span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">subs</span><span class="special">[]</span> <span class="special">=</span> <span class="special">{</span><span class="number">1</span><span class="special">,</span> <span class="number">0</span><span class="special">,};</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">i</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">subs</span><span class="special">);</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">sregex_token_iterator</span> <span class="identifier">j</span><span class="special">;</span>
|
||||
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">++</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="regex_iterator.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bad_expression.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,102 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>regex_traits</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="error_type.html" title="error_type">
|
||||
<link rel="next" href="non_std_strings.html" title="Interfacing With Non-Standard String Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="error_type.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_std_strings.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.regex_traits"></a><a href="regex_traits.html" title="regex_traits"> regex_traits</a></h3></div></div></div>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">boost</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">implementationT</span> <span class="special">=</span> <span class="identifier">sensible_default_choice</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">regex_traits</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">implementationT</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">regex_traits</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">implementationT</span><span class="special">()</span> <span class="special">{}</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">struct</span> <span class="identifier">c_regex_traits</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">struct</span> <span class="identifier">cpp_regex_traits</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">struct</span> <span class="identifier">w32_regex_traits</span><span class="special">;</span>
|
||||
|
||||
<span class="special">}</span> <span class="comment">// namespace boost
|
||||
</span></pre>
|
||||
<a name="boost_regex.ref.regex_traits.description"></a><h5>
|
||||
<a name="id613496"></a>
|
||||
<a href="regex_traits.html#boost_regex.ref.regex_traits.description">Description</a>
|
||||
</h5>
|
||||
<p>
|
||||
The class <code class="computeroutput"><span class="identifier">regex_traits</span></code> is
|
||||
just a thin wrapper around an actual implemention class, which may be one
|
||||
of:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<code class="computeroutput"><span class="identifier">c_regex_traits</span></code>: this class
|
||||
is deprecated, it wraps the C locale, and is used as the default implementation
|
||||
when the platform is not Win32, and the C++ locale is not available.
|
||||
</li>
|
||||
<li>
|
||||
<code class="computeroutput"><span class="identifier">cpp_regex_traits</span></code>: the default
|
||||
traits class for non-Win32 platforms, allows the regex class to be imbued
|
||||
with a std::locale instance.
|
||||
</li>
|
||||
<li>
|
||||
<code class="computeroutput"><span class="identifier">w32_regex_traits</span></code>: the default
|
||||
traits class implementation on Win32 platforms, allows the regex class
|
||||
to be imbued with an LCID.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The default behavior can be altered by defining one of the following configuration
|
||||
macros in <a href="../../../../../../boost/regex/user.hpp" target="_top">boost/regex/user.hpp</a>
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
BOOST_REGEX_USE_C_LOCALE: makes <code class="computeroutput"><span class="identifier">c_regex_traits</span></code>
|
||||
the default.
|
||||
</li>
|
||||
<li>
|
||||
BOOST_REGEX_USE_CPP_LOCALE: makes <code class="computeroutput"><span class="identifier">cpp_regex_traits</span></code>
|
||||
the default.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
All these traits classes fulfil the <a href="concepts/traits_concept.html" title="Traits Class Requirements">traits
|
||||
class requirements</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="error_type.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="non_std_strings.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>syntax_option_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../ref.html" title="Reference">
|
||||
<link rel="prev" href="bad_expression.html" title="bad_expression">
|
||||
<link rel="next" href="syntax_option_type/syntax_option_type_synopsis.html" title="syntax_option_type Synopsis">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bad_expression.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type/syntax_option_type_synopsis.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type"></a><a href="syntax_option_type.html" title="syntax_option_type"> syntax_option_type</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_synopsis.html">
|
||||
syntax_option_type Synopsis</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_overview.html">
|
||||
Overview of syntax_option_type</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_perl.html">
|
||||
Options for Perl Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_extended.html">
|
||||
Options for POSIX Extended Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_basic.html">
|
||||
Options for POSIX Basic Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax_option_type/syntax_option_type_literal.html">
|
||||
Options for Literal Strings</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bad_expression.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type/syntax_option_type_synopsis.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,387 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Options for POSIX Basic Regular Expressions</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="syntax_option_type_extended.html" title="Options for POSIX Extended Regular Expressions">
|
||||
<link rel="next" href="syntax_option_type_literal.html" title="Options for Literal Strings">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_extended.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_literal.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_basic"></a><a href="syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions">
|
||||
Options for POSIX Basic Regular Expressions</a></h4></div></div></div>
|
||||
<p>
|
||||
Exactly one of the following must always be set for POSIX basic regular
|
||||
expressions:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect When Set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
basic
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine is the same as that used by <a href="../../syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX
|
||||
basic regular expressions</a> in IEEE Std 1003.1-2001, Portable
|
||||
Operating System Interface (POSIX ), Base Definitions and Headers,
|
||||
Section 9, Regular Expressions (FWD.1).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
sed
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As Above.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
grep
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine is the same as that used by POSIX utility <code class="computeroutput"><span class="identifier">grep</span></code> in IEEE Std 1003.1-2001,
|
||||
Portable Operating System Interface (POSIX ), Shells and Utilities,
|
||||
Section 4, Utilit\ies, grep (FWD.1).
|
||||
</p>
|
||||
<p>
|
||||
That is to say, the same as <a href="../../syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX
|
||||
basic syntax</a>, but with the newline character acting as an
|
||||
alternation character; the expression is treated as a newline separated
|
||||
list of alternatives.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
emacs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognised is the superset of the <a href="../../syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX-Basic syntax</a>
|
||||
used by the emacs program.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The following options may also be set when using POSIX basic regular expressions:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
icase
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that matching of regular expressions against a character
|
||||
container sequence shall be performed without regard to case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
nosubs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression is matched against a character
|
||||
container sequence, then no sub-expression matches are to be stored
|
||||
in the supplied <a href="../match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> structure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
optimize
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the regular expression engine should pay more attention
|
||||
to the speed with which regular expressions are matched, and less
|
||||
to the speed with which regular expression objects are constructed.
|
||||
Otherwise it has no detectable effect on the program output. This
|
||||
currently has no effect for Boost.Regex.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
collate
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that character ranges of the form <code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">b</span><span class="special">]</span></code>
|
||||
should be locale sensitive. This bit is on by default for <a href="../../syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX-Basic regular expressions</a>,
|
||||
but can be unset to force ranges to be compared by code point only.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
newline_alt
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the \n character has the same effect as the alternation
|
||||
operator |. Allows newline separated lists to be used as a list
|
||||
of alternatives. This bit is already set, if you use the <code class="computeroutput"><span class="identifier">grep</span></code> option.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_char_classes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set then character classes such as <code class="computeroutput"><span class="special">[[:</span><span class="identifier">alnum</span><span class="special">:]]</span></code>
|
||||
are not allowed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_escape_in_lists
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set this makes the escape character ordinary inside lists,
|
||||
so that <code class="computeroutput"><span class="special">[\</span><span class="identifier">b</span><span class="special">]</span></code> would match either '\' or 'b'.
|
||||
This bit is on by default for <a href="../../syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX-basic
|
||||
regular expressions</a>, but can be unset to force escapes to
|
||||
be recognised inside lists.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_intervals
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set then bounded repeats such as a{2,3} are not permitted.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
bk_plus_qm
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set then <code class="computeroutput"><span class="special">\?</span></code> acts
|
||||
as a zero-or-one repeat operator, and <code class="computeroutput"><span class="special">\+</span></code>
|
||||
acts as a one-or-more repeat operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
bk_vbar
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set then <code class="computeroutput"><span class="special">\|</span></code> acts
|
||||
as the alternation operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_except
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Prevents <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> from throwing
|
||||
an exception when an invalid expression is encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_extended.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_literal.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,339 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Options for POSIX Extended Regular Expressions</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="syntax_option_type_perl.html" title="Options for Perl Regular Expressions">
|
||||
<link rel="next" href="syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_perl.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_basic.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_extended"></a><a href="syntax_option_type_extended.html" title="Options for POSIX Extended Regular Expressions">
|
||||
Options for POSIX Extended Regular Expressions</a></h4></div></div></div>
|
||||
<p>
|
||||
Exactly one of the following must always be set for <a href="../../syntax/basic_extended.html" title="POSIX Extended Regular Expression Syntax">POSIX
|
||||
extended regular expressions</a>:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
extended
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine is the same as that used by POSIX extended regular expressions
|
||||
in IEEE Std 1003.1-2001, Portable Operating System Interface (POSIX
|
||||
), Base Definitions and Headers, Section 9, Regular Expressions
|
||||
(FWD.1). Refer to the <a href="../../syntax/basic_extended.html" title="POSIX Extended Regular Expression Syntax">POSIX
|
||||
extended regular expression guide</a> for more information.
|
||||
</p>
|
||||
<p>
|
||||
In addition some perl-style escape sequences are supported (The
|
||||
POSIX standard specifies that only "special" characters
|
||||
may be escaped, all other escape sequences result in undefined
|
||||
behavior).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
egrep
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine is the same as that used by POSIX utility grep when given
|
||||
the -E option in IEEE Std 1003.1-2001, Portable Operating System
|
||||
Interface (POSIX ), Shells and Utilities, Section 4, Utilities,
|
||||
grep (FWD.1).
|
||||
</p>
|
||||
<p>
|
||||
That is to say, the same as <a href="../../syntax/basic_extended.html" title="POSIX Extended Regular Expression Syntax">POSIX
|
||||
extended syntax</a>, but with the newline character acting as
|
||||
an alternation character in addition to "|".
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
awk
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine is the same as that used by POSIX utility awk in IEEE Std
|
||||
1003.1-2001, Portable Operating System Interface (POSIX ), Shells
|
||||
and Utilities, Section 4, awk (FWD.1).
|
||||
</p>
|
||||
<p>
|
||||
That is to say: the same as <a href="../../syntax/basic_extended.html" title="POSIX Extended Regular Expression Syntax">POSIX
|
||||
extended syntax</a>, but with escape sequences in character
|
||||
classes permitted.
|
||||
</p>
|
||||
<p>
|
||||
In addition some perl-style escape sequences are supported (actually
|
||||
the awk syntax only requires \a \b \t \v \f \n and \r to be recognised,
|
||||
all other Perl-style escape sequences invoke undefined behavior
|
||||
according to the POSIX standard, but are in fact recognised by
|
||||
Boost.Regex).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The following options may also be set when using POSIX extended regular
|
||||
expressions:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
icase
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that matching of regular expressions against a character
|
||||
container sequence shall be performed without regard to case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
nosubs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression is matched against a character
|
||||
container sequence, then no sub-expression matches are to be stored
|
||||
in the supplied <a href="../match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> structure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
optimize
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the regular expression engine should pay more attention
|
||||
to the speed with which regular expressions are matched, and less
|
||||
to the speed with which regular expression objects are constructed.
|
||||
Otherwise it has no detectable effect on the program output. This
|
||||
currently has no effect for Boost.Regex.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
collate
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that character ranges of the form <code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">b</span><span class="special">]</span></code>
|
||||
should be locale sensitive. This bit is on by default for POSIX-Extended
|
||||
regular expressions, but can be unset to force ranges to be compared
|
||||
by code point only.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
newline_alt
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the \n character has the same effect as the alternation
|
||||
operator |. Allows newline separated lists to be used as a list
|
||||
of alternatives.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_escape_in_lists
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set this makes the escape character ordinary inside lists,
|
||||
so that <code class="computeroutput"><span class="special">[\</span><span class="identifier">b</span><span class="special">]</span></code> would match either '\' or 'b'.
|
||||
This bit is on by default for POSIX-Extended regular expressions,
|
||||
but can be unset to force escapes to be recognised inside lists.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_bk_refs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
When set then backreferences are disabled. This bit is on by default
|
||||
for POSIX-Extended regular expressions, but can be unset to support
|
||||
for backreferences on.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_except
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Prevents <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> from throwing
|
||||
an exception when an invalid expression is encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_perl.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_basic.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,152 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Options for Literal Strings</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions">
|
||||
<link rel="next" href="../match_flag_type.html" title="match_flag_type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_basic.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../match_flag_type.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_literal"></a><a href="syntax_option_type_literal.html" title="Options for Literal Strings">
|
||||
Options for Literal Strings</a></h4></div></div></div>
|
||||
<p>
|
||||
The following must always be set to interpret the expression as a string
|
||||
literal:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
literal
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Treat the string as a literal (no special characters).
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The following options may also be combined with the literal flag:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
icase
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that matching of regular expressions against a character
|
||||
container sequence shall be performed without regard to case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
optimize
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the regular expression engine should pay more attention
|
||||
to the speed with which regular expressions are matched, and less
|
||||
to the speed with which regular expression objects are constructed.
|
||||
Otherwise it has no detectable effect on the program output. This
|
||||
currently has no effect for Boost.Regex.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_basic.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../match_flag_type.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Overview of syntax_option_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="syntax_option_type_synopsis.html" title="syntax_option_type Synopsis">
|
||||
<link rel="next" href="syntax_option_type_perl.html" title="Options for Perl Regular Expressions">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_synopsis.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_perl.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_overview"></a><a href="syntax_option_type_overview.html" title="Overview of syntax_option_type">
|
||||
Overview of syntax_option_type</a></h4></div></div></div>
|
||||
<p>
|
||||
The type <a href="../syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a> is an implementation
|
||||
specific bitmask type (see C++ standard 17.3.2.1.2). Setting its elements
|
||||
has the effects listed in the table below, a valid value of type <a href="../syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a>
|
||||
will always have exactly one of the elements <code class="computeroutput"><span class="identifier">normal</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">basic</span></code>, <code class="computeroutput"><span class="identifier">extended</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">awk</span></code>, <code class="computeroutput"><span class="identifier">grep</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">egrep</span></code>, <code class="computeroutput"><span class="identifier">sed</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">literal</span></code> or <code class="computeroutput"><span class="identifier">perl</span></code> set.
|
||||
</p>
|
||||
<p>
|
||||
Note that for convenience all the constants listed here are duplicated
|
||||
within the scope of class template <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>, so you can use any
|
||||
of:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">constant_name</span>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">constant_name</span>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">wregex</span><span class="special">::</span><span class="identifier">constant_name</span>
|
||||
</pre>
|
||||
<p>
|
||||
in an interchangeable manner.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_synopsis.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_perl.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,383 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Options for Perl Regular Expressions</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="syntax_option_type_overview.html" title="Overview of syntax_option_type">
|
||||
<link rel="next" href="syntax_option_type_extended.html" title="Options for POSIX Extended Regular Expressions">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_overview.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_extended.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_perl"></a><a href="syntax_option_type_perl.html" title="Options for Perl Regular Expressions">
|
||||
Options for Perl Regular Expressions</a></h4></div></div></div>
|
||||
<p>
|
||||
One of the following must always be set for perl regular expressions:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ECMAScript
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the grammar recognized by the regular expression
|
||||
engine uses its normal semantics: that is the same as that given
|
||||
in the ECMA-262, ECMAScript Language Specification, Chapter 15
|
||||
part 10, RegExp (Regular Expression) Objects (FWD.1). This is functionally
|
||||
identical to the <a href="../../syntax/perl_syntax.html" title="Perl Regular Expression Syntax">Perl
|
||||
regular expression syntax</a>.
|
||||
</p>
|
||||
<p>
|
||||
Boost.Regex also recognizes all of the perl-compatible <code class="computeroutput"><span class="special">(?...)</span></code> extensions in this mode.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
perl
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As above.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
normal
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As above.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
JavaScript
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As above.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
JScript
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
As above.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The following options may also be set when using perl-style regular expressions:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Element
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Standardized
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Effect when set
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
icase
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that matching of regular expressions against a character
|
||||
container sequence shall be performed without regard to case.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
nosubs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that when a regular expression is matched against a character
|
||||
container sequence, then no sub-expression matches are to be stored
|
||||
in the supplied <a href="../match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> structure.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
optimize
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the regular expression engine should pay more attention
|
||||
to the speed with which regular expressions are matched, and less
|
||||
to the speed with which regular expression objects are constructed.
|
||||
Otherwise it has no detectable effect on the program output. This
|
||||
currently has no effect for Boost.Regex.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
collate
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that character ranges of the form <code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">b</span><span class="special">]</span></code>
|
||||
should be locale sensitive.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
newline_alt
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Specifies that the \n character has the same effect as the alternation
|
||||
operator |. Allows newline separated lists to be used as a list
|
||||
of alternatives.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_except
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Prevents <a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> from throwing
|
||||
an exception when an invalid expression is encountered.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_mod_m
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Normally Boost.Regex behaves as if the Perl m-modifier is on: so
|
||||
the assertions ^ and $ match after and before embedded newlines
|
||||
respectively, setting this flags is equivalent to prefixing the
|
||||
expression with (?-m).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
no_mod_s
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Normally whether Boost.Regex will match "." against a
|
||||
newline character is determined by the match flag <code class="computeroutput"><span class="identifier">match_dot_not_newline</span></code>. Specifying
|
||||
this flag is equivalent to prefixing the expression with <code class="computeroutput"><span class="special">(?-</span><span class="identifier">s</span><span class="special">)</span></code> and therefore causes "."
|
||||
not to match a newline character regardless of whether <code class="computeroutput"><span class="identifier">match_not_dot_newline</span></code> is set
|
||||
in the match flags.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
mod_s
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Normally whether Boost.Regex will match "." against a
|
||||
newline character is determined by the match flag <code class="computeroutput"><span class="identifier">match_dot_not_newline</span></code>. Specifying
|
||||
this flag is equivalent to prefixing the expression with <code class="computeroutput"><span class="special">(?</span><span class="identifier">s</span><span class="special">)</span></code> and therefore causes "."
|
||||
to match a newline character regardless of whether <code class="computeroutput"><span class="identifier">match_not_dot_newline</span></code> is set
|
||||
in the match flags.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
mod_x
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Turns on the perl x-modifier: causes unescaped whitespace in the
|
||||
expression to be ignored.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="syntax_option_type_overview.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_extended.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>syntax_option_type Synopsis</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="prev" href="../syntax_option_type.html" title="syntax_option_type">
|
||||
<link rel="next" href="syntax_option_type_overview.html" title="Overview of syntax_option_type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_overview.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.ref.syntax_option_type.syntax_option_type_synopsis"></a><a href="syntax_option_type_synopsis.html" title="syntax_option_type Synopsis">
|
||||
syntax_option_type Synopsis</a></h4></div></div></div>
|
||||
<p>
|
||||
Type <a href="../syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a>
|
||||
is an implementation specific bitmask type that controls how a regular
|
||||
expression string is to be interpreted. For convenience note that all the
|
||||
constants listed here, are also duplicated within the scope of class template
|
||||
<a href="../basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a>.
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="keyword">namespace</span> <span class="identifier">std</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">regex_constants</span><span class="special">{</span>
|
||||
|
||||
<span class="keyword">typedef</span> <span class="identifier">implementation</span><span class="special">-</span><span class="identifier">specific</span><span class="special">-</span><span class="identifier">bitmask</span><span class="special">-</span><span class="identifier">type</span> <span class="identifier">syntax_option_type</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// these flags are standardized:
|
||||
</span><span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">normal</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">ECMAScript</span> <span class="special">=</span> <span class="identifier">normal</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">JavaScript</span> <span class="special">=</span> <span class="identifier">normal</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">JScript</span> <span class="special">=</span> <span class="identifier">normal</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">perl</span> <span class="special">=</span> <span class="identifier">normal</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">basic</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">sed</span> <span class="special">=</span> <span class="identifier">basic</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">extended</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">awk</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">grep</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">egrep</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">icase</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">nosubs</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">optimize</span><span class="special">;</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">collate</span><span class="special">;</span>
|
||||
<span class="comment">// other Boost.Regex specific options are listed below
|
||||
</span>
|
||||
<span class="special">}</span> <span class="comment">// namespace regex_constants
|
||||
</span><span class="special">}</span> <span class="comment">// namespace std
|
||||
</span></pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax_option_type.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type_overview.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,103 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Regular Expression Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="partial_matches.html" title="Partial Matches">
|
||||
<link rel="next" href="syntax/perl_syntax.html" title="Perl Regular Expression Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="partial_matches.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax/perl_syntax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.syntax"></a><a href="syntax.html" title="Regular Expression Syntax"> Regular Expression Syntax</a></h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="syntax/perl_syntax.html"> Perl Regular Expression
|
||||
Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/basic_extended.html"> POSIX Extended Regular
|
||||
Expression Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/basic_syntax.html"> POSIX Basic Regular
|
||||
Expression Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/character_classes.html"> Character Class
|
||||
Names</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="syntax/character_classes/std_char_clases.html">
|
||||
Character Classes that are Always Supported</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/character_classes/optional_char_class_names.html">
|
||||
Character classes that are supported by Unicode Regular Expressions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="syntax/collating_names.html"> Collating Names</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="syntax/collating_names/digraphs.html"> Digraphs</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/collating_names/posix_symbolic_names.html">
|
||||
POSIX Symbolic Names</a></span></dt>
|
||||
<dt><span class="section"><a href="syntax/collating_names/named_unicode.html">
|
||||
Named Unicode Characters</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="syntax/leftmost_longest_rule.html"> The Leftmost
|
||||
Longest Rule</a></span></dt>
|
||||
</dl></div>
|
||||
<p>
|
||||
This section covers the regular expression syntax used by this library, this
|
||||
is a programmers guide, the actual syntax presented to your program's users
|
||||
will depend upon the flags used during expression compilation.
|
||||
</p>
|
||||
<p>
|
||||
There are three main syntax options available, depending upon how you construct
|
||||
the regular expression object:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
<a href="syntax/perl_syntax.html" title="Perl Regular Expression Syntax">Perl (this is the default
|
||||
behavior)</a>.
|
||||
</li>
|
||||
<li>
|
||||
<a href="syntax/basic_extended.html" title="POSIX Extended Regular Expression Syntax">POSIX extended (including
|
||||
the egrep and awk variations)</a>.
|
||||
</li>
|
||||
<li>
|
||||
<a href="syntax/basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX Basic (including the
|
||||
grep and emacs variations)</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
You can also construct a regular expression that treats every character as
|
||||
a literal, but that's not really a "syntax"!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="partial_matches.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="syntax/perl_syntax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,657 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>POSIX Basic Regular Expression Syntax</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax.html" title="Regular Expression Syntax">
|
||||
<link rel="prev" href="basic_extended.html" title="POSIX Extended Regular Expression Syntax">
|
||||
<link rel="next" href="character_classes.html" title="Character Class Names">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_extended.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="character_classes.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.syntax.basic_syntax"></a><a href="basic_syntax.html" title="POSIX Basic Regular Expression Syntax"> POSIX Basic Regular
|
||||
Expression Syntax</a></h3></div></div></div>
|
||||
<a name="boost_regex.syntax.basic_syntax.synopsis"></a><h4>
|
||||
<a name="id518494"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.synopsis">Synopsis</a>
|
||||
</h4>
|
||||
<p>
|
||||
The POSIX-Basic regular expression syntax is used by the Unix utility <code class="computeroutput"><span class="identifier">sed</span></code>, and variations are used by <code class="computeroutput"><span class="identifier">grep</span></code> and <code class="computeroutput"><span class="identifier">emacs</span></code>.
|
||||
You can construct POSIX basic regular expressions in Boost.Regex by passing
|
||||
the flag <code class="computeroutput"><span class="identifier">basic</span></code> to the regex
|
||||
constructor (see <a href="../ref/syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a>), for example:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="comment">// e1 is a case sensitive POSIX-Basic expression:
|
||||
</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e1</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">basic</span><span class="special">);</span>
|
||||
<span class="comment">// e2 a case insensitive POSIX-Basic expression:
|
||||
</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">basic</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.posix_basic"></a><p>
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.posix_basic_syntax"></a><h4>
|
||||
<a name="id518788"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.posix_basic_syntax">POSIX
|
||||
Basic Syntax</a>
|
||||
</h4>
|
||||
<p>
|
||||
In POSIX-Basic regular expressions, all characters are match themselves except
|
||||
for the following special characters:
|
||||
</p>
|
||||
<pre class="programlisting">.[\*^$</pre>
|
||||
<a name="boost_regex.syntax.basic_syntax.wildcard_"></a><h5>
|
||||
<a name="id518829"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.wildcard_">Wildcard:</a>
|
||||
</h5>
|
||||
<p>
|
||||
The single character '.' when used outside of a character set will match
|
||||
any single character except:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
The NULL character when the flag <code class="computeroutput"><span class="identifier">match_no_dot_null</span></code>
|
||||
is passed to the matching algorithms.
|
||||
</li>
|
||||
<li>
|
||||
The newline character when the flag <code class="computeroutput"><span class="identifier">match_not_dot_newline</span></code>
|
||||
is passed to the matching algorithms.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.syntax.basic_syntax.anchors_"></a><h5>
|
||||
<a name="id518899"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.anchors_">Anchors:</a>
|
||||
</h5>
|
||||
<p>
|
||||
A '^' character shall match the start of a line when used as the first character
|
||||
of an expression, or the first character of a sub-expression.
|
||||
</p>
|
||||
<p>
|
||||
A '$' character shall match the end of a line when used as the last character
|
||||
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="id518937"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.marked_sub_expressions_">Marked
|
||||
sub-expressions:</a>
|
||||
</h5>
|
||||
<p>
|
||||
A section beginning <code class="computeroutput"><span class="special">\(</span></code> and ending
|
||||
<code class="computeroutput"><span class="special">\)</span></code> acts as a marked sub-expression.
|
||||
Whatever matched the sub-expression is split out in a separate field by the
|
||||
matching algorithms. Marked sub-expressions can also repeated, or referred-to
|
||||
by a back-reference.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.repeats_"></a><h5>
|
||||
<a name="id518996"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.repeats_">Repeats:</a>
|
||||
</h5>
|
||||
<p>
|
||||
Any atom (a single character, a marked sub-expression, or a character class)
|
||||
can be repeated with the * operator.
|
||||
</p>
|
||||
<p>
|
||||
For example <code class="computeroutput"><span class="identifier">a</span><span class="special">*</span></code>
|
||||
will match any number of letter a's repeated zero or more times (an atom
|
||||
repeated zero times matches an empty string), so the expression <code class="computeroutput"><span class="identifier">a</span><span class="special">*</span><span class="identifier">b</span></code>
|
||||
will match any of the following:
|
||||
</p>
|
||||
<pre class="programlisting">b
|
||||
ab
|
||||
aaaaaaaab
|
||||
</pre>
|
||||
<p>
|
||||
An atom can also be repeated with a bounded repeat:
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">\}</span></code> Matches
|
||||
'a' repeated exactly n times.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">,\}</span></code> Matches
|
||||
'a' repeated n or more times.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">m</span><span class="special">\}</span></code> Matches 'a' repeated between n and m times
|
||||
inclusive.
|
||||
</p>
|
||||
<p>
|
||||
For example:
|
||||
</p>
|
||||
<pre class="programlisting">^a{2,3}$</pre>
|
||||
<p>
|
||||
Will match either of:
|
||||
</p>
|
||||
<pre class="programlisting">aa
|
||||
aaa
|
||||
</pre>
|
||||
<p>
|
||||
But neither of:
|
||||
</p>
|
||||
<pre class="programlisting">a
|
||||
aaaa
|
||||
</pre>
|
||||
<p>
|
||||
It is an error to use a repeat operator, if the preceding construct can not
|
||||
be repeated, for example:
|
||||
</p>
|
||||
<pre class="programlisting">a(*)</pre>
|
||||
<p>
|
||||
Will raise an error, as there is nothing for the * operator to be applied
|
||||
to.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.back_references_"></a><h5>
|
||||
<a name="id519242"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.back_references_">Back references:</a>
|
||||
</h5>
|
||||
<p>
|
||||
An escape character followed by a digit <span class="emphasis"><em>n</em></span>, where <span class="emphasis"><em>n</em></span>
|
||||
is in the range 1-9, matches the same string that was matched by sub-expression
|
||||
<span class="emphasis"><em>n</em></span>. For example the expression:
|
||||
</p>
|
||||
<pre class="programlisting">^\(a*\).*\1$</pre>
|
||||
<p>
|
||||
Will match the string:
|
||||
</p>
|
||||
<pre class="programlisting">aaabbaaa</pre>
|
||||
<p>
|
||||
But not the string:
|
||||
</p>
|
||||
<pre class="programlisting">aaabba</pre>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_sets_"></a><h5>
|
||||
<a name="id519318"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_sets_">Character
|
||||
sets:</a>
|
||||
</h5>
|
||||
<p>
|
||||
A character set is a bracket-expression starting with [ and ending with ],
|
||||
it defines a set of characters, and matches any single character that is
|
||||
a member of that set.
|
||||
</p>
|
||||
<p>
|
||||
A bracket expression may contain any combination of the following:
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.single_characters_"></a><h6>
|
||||
<a name="id519355"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.single_characters_">Single
|
||||
characters:</a>
|
||||
</h6>
|
||||
<p>
|
||||
For example <code class="computeroutput"><span class="special">[</span><span class="identifier">abc</span><span class="special">]</span></code>, will match any of the characters 'a', 'b',
|
||||
or 'c'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_ranges_"></a><h6>
|
||||
<a name="id519408"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_ranges_">Character
|
||||
ranges:</a>
|
||||
</h6>
|
||||
<p>
|
||||
For example <code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">]</span></code>
|
||||
will match any single character in the range 'a' to 'c'. By default, for
|
||||
POSIX-Basic regular expressions, a character <span class="emphasis"><em>x</em></span> is within
|
||||
the range <span class="emphasis"><em>y</em></span> to <span class="emphasis"><em>z</em></span>, if it collates
|
||||
within that range; this results in locale specific behavior. This behavior
|
||||
can be turned off by unsetting the <code class="computeroutput"><span class="identifier">collate</span></code>
|
||||
option flag when constructing the regular expression - in which case whether
|
||||
a character appears within a range is determined by comparing the code points
|
||||
of the characters only.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.negation_"></a><h6>
|
||||
<a name="id519501"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.negation_">Negation:</a>
|
||||
</h6>
|
||||
<p>
|
||||
If the bracket-expression begins with the ^ character, then it matches the
|
||||
complement of the characters it contains, for example <code class="computeroutput"><span class="special">[^</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">]</span></code> matches any character that is not in the
|
||||
range a-c.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.character_classes_"></a><h6>
|
||||
<a name="id519563"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_classes_">Character
|
||||
classes:</a>
|
||||
</h6>
|
||||
<p>
|
||||
An expression of the form <code class="computeroutput"><span class="special">[[:</span><span class="identifier">name</span><span class="special">:]]</span></code>
|
||||
matches the named character class "name", for example <code class="computeroutput"><span class="special">[[:</span><span class="identifier">lower</span><span class="special">:]]</span></code> matches any lower case character. See
|
||||
<a 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="id519647"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.collating_elements_">Collating
|
||||
Elements:</a>
|
||||
</h6>
|
||||
<p>
|
||||
An expression of the form <code class="computeroutput"><span class="special">[[.</span><span class="identifier">col</span><span class="special">.]</span></code> matches
|
||||
the collating element <span class="emphasis"><em>col</em></span>. A collating element is any
|
||||
single character, or any sequence of characters that collates as a single
|
||||
unit. Collating elements may also be used as the end point of a range, for
|
||||
example: <code class="computeroutput"><span class="special">[[.</span><span class="identifier">ae</span><span class="special">.]-</span><span class="identifier">c</span><span class="special">]</span></code>
|
||||
matches the character sequence "ae", plus any single character
|
||||
in the rangle "ae"-c, assuming that "ae" is treated as
|
||||
a single collating element in the current locale.
|
||||
</p>
|
||||
<p>
|
||||
Collating elements may be used in place of escapes (which are not normally
|
||||
allowed inside character sets), for example <code class="computeroutput"><span class="special">[[.^.]</span><span class="identifier">abc</span><span class="special">]</span></code> would
|
||||
match either one of the characters 'abc^'.
|
||||
</p>
|
||||
<p>
|
||||
As an extension, a collating element may also be specified via its symbolic
|
||||
name, for example:
|
||||
</p>
|
||||
<pre class="programlisting">[[.NUL.]]</pre>
|
||||
<p>
|
||||
matches a 'NUL' character. See <a href="collating_names.html" title="Collating Names">collating
|
||||
element names</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.equivalence_classes_"></a><h6>
|
||||
<a name="id519794"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.equivalence_classes_">Equivalence
|
||||
classes:</a>
|
||||
</h6>
|
||||
<p>
|
||||
An expression of theform <code class="computeroutput"><span class="special">[[=</span><span class="identifier">col</span><span class="special">=]]</span></code>,
|
||||
matches any character or collating element whose primary sort key is the
|
||||
same as that for collating element <span class="emphasis"><em>col</em></span>, as with collating
|
||||
elements the name <span class="emphasis"><em>col</em></span> may be a <a href="collating_names.html" title="Collating Names">collating
|
||||
symbolic name</a>. A primary sort key is one that ignores case, accentation,
|
||||
or locale-specific tailorings; so for example <code class="computeroutput"><span class="special">[[=</span><span class="identifier">a</span><span class="special">=]]</span></code> matches
|
||||
any of the characters: a, À, Á, Â, Ã, Ä, Å, A, à, á, â, ã, ä and å. Unfortunately implementation
|
||||
of this is reliant on the platform's collation and localisation support;
|
||||
this feature can not be relied upon to work portably across all platforms,
|
||||
or even all locales on one platform.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.combinations_"></a><h6>
|
||||
<a name="id519904"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.combinations_">Combinations:</a>
|
||||
</h6>
|
||||
<p>
|
||||
All of the above can be combined in one character set declaration, for example:
|
||||
<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="id519982"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.escapes">Escapes</a>
|
||||
</h5>
|
||||
<p>
|
||||
With the exception of the escape sequences \{, \}, \(, and \), which are
|
||||
documented above, an escape followed by any character matches that character.
|
||||
This can be used to make the special characters
|
||||
</p>
|
||||
<pre class="programlisting">.[\*^$</pre>
|
||||
<p>
|
||||
"ordinary". Note that the escape character loses its special meaning
|
||||
inside a character set, so <code class="computeroutput"><span class="special">[\^]</span></code>
|
||||
will match either a literal '\' or a '^'.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.what_gets_matched"></a><h4>
|
||||
<a name="id520041"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.what_gets_matched">What Gets
|
||||
Matched</a>
|
||||
</h4>
|
||||
<p>
|
||||
When there is more that one way to match a regular expression, the "best"
|
||||
possible match is obtained using the <a href="leftmost_longest_rule.html" title="The Leftmost Longest Rule">leftmost-longest
|
||||
rule</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.variations"></a><h4>
|
||||
<a name="id520082"></a>
|
||||
<a 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="id520116"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.grep">Grep</a>
|
||||
</h5>
|
||||
<p>
|
||||
When an expression is compiled with the flag <code class="computeroutput"><span class="identifier">grep</span></code>
|
||||
set, then the expression is treated as a newline separated list of <a href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic expressions</a>, a match
|
||||
is found if any of the expressions in the list match, for example:
|
||||
</p>
|
||||
<pre class="programlisting">
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"abc\ndef"</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">grep</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
will match either of the <a href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic
|
||||
expressions</a> "abc" or "def".
|
||||
</p>
|
||||
<p>
|
||||
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="id520263"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.emacs">emacs</a>
|
||||
</h5>
|
||||
<p>
|
||||
In addition to the <a href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic features</a>
|
||||
the following characters are also special:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Character
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
+
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
repeats the preceding atom one or more times.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
?
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
repeats the preceding atom zero or one times.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
*?
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A non-greedy version of *.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
+?
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A non-greedy version of +.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
??
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A non-greedy version of ?.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
And the following escape sequences are also recognised:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Escape
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\|
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
specifies an alternative.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\(?: ... )
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
is a non-marking grouping construct - allows you to lexically group
|
||||
something without spitting out an extra sub-expression.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\w
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches any word character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\W
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches any non-word character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\sx
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches any character in the syntax group x, the following emacs
|
||||
groupings are supported: 's', ' ', '_', 'w', '.', ')', '(', '"',
|
||||
'\'', '>' and '<'. Refer to the emacs docs for details.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\Sx
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches any character not in the syntax grouping x.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\c and \C
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
These are not supported.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\`
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters only at the start of a buffer (or string
|
||||
being matched).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\'
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters only at the end of a buffer (or string being
|
||||
matched).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\b
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters at a word boundary.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\B
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters, not at a word boundary.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\<
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters only at the start of a word.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
\>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
matches zero characters only at the end of a word.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Finally, you should note that emacs style regular expressions are matched
|
||||
according to the <a href="perl_syntax.html#boost_regex.syntax.perl_syntax.what_gets_matched">Perl
|
||||
"depth first search" rules</a>. Emacs expressions are matched
|
||||
this way because they contain Perl-like extensions, that do not interact
|
||||
well with the <a href="leftmost_longest_rule.html" title="The Leftmost Longest Rule">POSIX-style
|
||||
leftmost-longest rule</a>.
|
||||
</p>
|
||||
<a name="boost_regex.syntax.basic_syntax.options"></a><h4>
|
||||
<a name="id520760"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.options">Options</a>
|
||||
</h4>
|
||||
<p>
|
||||
There are a <a href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions">variety
|
||||
of flags</a> that may be combined with the <code class="computeroutput"><span class="identifier">basic</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">grep</span></code> options when constructing
|
||||
the regular expression, in particular note that the <a href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions"><code class="computeroutput"><span class="identifier">newline_alt</span></code>, <code class="computeroutput"><span class="identifier">no_char_classes</span></code>,
|
||||
<code class="computeroutput"><span class="identifier">no</span><span class="special">-</span><span class="identifier">intervals</span></code>, <code class="computeroutput"><span class="identifier">bk_plus_qm</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">bk_plus_vbar</span></code></a> options
|
||||
all alter the syntax, while the <a href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions"><code class="computeroutput"><span class="identifier">collate</span></code> and <code class="computeroutput"><span class="identifier">icase</span></code>
|
||||
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="id520935"></a>
|
||||
<a href="basic_syntax.html#boost_regex.syntax.basic_syntax.references">References</a>
|
||||
</h4>
|
||||
<p>
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html" target="_top">IEEE
|
||||
Std 1003.1-2001, Portable Operating System Interface (POSIX ), Base Definitions
|
||||
and Headers, Section 9, Regular Expressions (FWD.1).</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://www.opengroup.org/onlinepubs/000095399/utilities/grep.html" target="_top">IEEE
|
||||
Std 1003.1-2001, Portable Operating System Interface (POSIX ), Shells and
|
||||
Utilities, Section 4, Utilities, grep (FWD.1).</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://www.gnu.org/software/emacs/" target="_top">Emacs Version 21.3.</a>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_extended.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="character_classes.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Character Class Names</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax.html" title="Regular Expression Syntax">
|
||||
<link rel="prev" href="basic_syntax.html" title="POSIX Basic Regular Expression Syntax">
|
||||
<link rel="next" href="character_classes/std_char_clases.html" title="Character Classes that are Always Supported">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_syntax.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="character_classes/std_char_clases.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.syntax.character_classes"></a><a href="character_classes.html" title="Character Class Names"> Character Class
|
||||
Names</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="character_classes/std_char_clases.html">
|
||||
Character Classes that are Always Supported</a></span></dt>
|
||||
<dt><span class="section"><a href="character_classes/optional_char_class_names.html">
|
||||
Character classes that are supported by Unicode Regular Expressions</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="basic_syntax.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="character_classes/std_char_clases.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,542 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Character classes that are supported by Unicode Regular Expressions</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../character_classes.html" title="Character Class Names">
|
||||
<link rel="prev" href="std_char_clases.html" title="Character Classes that are Always Supported">
|
||||
<link rel="next" href="../collating_names.html" title="Collating Names">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="std_char_clases.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../character_classes.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../collating_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.syntax.character_classes.optional_char_class_names"></a><a href="optional_char_class_names.html" title="Character classes that are supported by Unicode Regular Expressions">
|
||||
Character classes that are supported by Unicode Regular Expressions</a></h4></div></div></div>
|
||||
<p>
|
||||
The following character classes are only supported by Unicode Regular Expressions:
|
||||
that is those that use the <code class="computeroutput"><span class="identifier">u32regex</span></code>
|
||||
type. The names used are the same as those from Chapter 4 of the Unicode
|
||||
standard.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Short Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Long Name
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
ASCII
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assigned
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
C*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Cc
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Control
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Cf
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Format
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Cn
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Not Assigned
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Co
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Private Use
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Cs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Surrogate
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
L*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Letter
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Ll
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Lowercase Letter
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Lm
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Modifier Letter
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Lo
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other Letter
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Lt
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Titlecase
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Lu
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Uppercase Letter
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
M*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Mark
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Mc
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Spacing Combining Mark
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Me
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Enclosing Mark
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Mn
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Non-Spacing Mark
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
N*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Number
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Nd
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Decimal Digit Number
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Nl
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Letter Number
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other Number
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
P*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Pc
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Connector Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Pd
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Dash Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Pe
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Close Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Pf
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Final Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Pi
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initial Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Po
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Ps
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Open Punctuation
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
S*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Symbol
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Sc
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Currency Symbol
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Sk
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Modifier Symbol
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Sm
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Math Symbol
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
So
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Other Symbol
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Z*
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Separator
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Zl
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Line Separator
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Zp
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Paragraph Separator
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
Zs
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Space Separator
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="std_char_clases.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../character_classes.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../collating_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,391 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Character Classes that are Always Supported</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../character_classes.html" title="Character Class Names">
|
||||
<link rel="prev" href="../character_classes.html" title="Character Class Names">
|
||||
<link rel="next" href="optional_char_class_names.html" title="Character classes that are supported by Unicode Regular Expressions">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../character_classes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../character_classes.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="optional_char_class_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.syntax.character_classes.std_char_clases"></a><a href="std_char_clases.html" title="Character Classes that are Always Supported">
|
||||
Character Classes that are Always Supported</a></h4></div></div></div>
|
||||
<p>
|
||||
The following character class names are always supported by Boost.Regex:
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
POSIX-standard name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
alnum
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any alpha-numeric character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
alpha
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any alphabetic character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
blank
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any whitespace character that is not a line separator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
cntrl
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any control character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
d
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any decimal digit
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
digit
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any decimal digit.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
graph
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any graphical character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
l
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any lower case character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
lower
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any lower case character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
print
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any printable character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
punct
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any punctuation character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
s
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any whitespace character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
space
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any whitespace character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
unicode
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any extended character whose code point is above 255 in value.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
u
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any upper case character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
upper
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any upper case character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
w
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any word character (alphanumeric characters plus the underscore).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
word
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
No
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any word character (alphanumeric characters plus the underscore).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
xdigit
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Yes
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Any hexadecimal digit character.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../character_classes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../character_classes.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="optional_char_class_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Collating Names</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax.html" title="Regular Expression Syntax">
|
||||
<link rel="prev" href="character_classes/optional_char_class_names.html" title="Character classes that are supported by Unicode Regular Expressions">
|
||||
<link rel="next" href="collating_names/digraphs.html" title="Digraphs">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="character_classes/optional_char_class_names.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="collating_names/digraphs.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.syntax.collating_names"></a><a href="collating_names.html" title="Collating Names"> Collating Names</a></h3></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="collating_names/digraphs.html"> Digraphs</a></span></dt>
|
||||
<dt><span class="section"><a href="collating_names/posix_symbolic_names.html">
|
||||
POSIX Symbolic Names</a></span></dt>
|
||||
<dt><span class="section"><a href="collating_names/named_unicode.html">
|
||||
Named Unicode Characters</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="character_classes/optional_char_class_names.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="collating_names/digraphs.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Digraphs</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../collating_names.html" title="Collating Names">
|
||||
<link rel="prev" href="../collating_names.html" title="Collating Names">
|
||||
<link rel="next" href="posix_symbolic_names.html" title="POSIX Symbolic Names">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../collating_names.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="posix_symbolic_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.syntax.collating_names.digraphs"></a><a href="digraphs.html" title="Digraphs"> Digraphs</a></h4></div></div></div>
|
||||
<p>
|
||||
The following are treated as valid digraphs when used as a collating name:
|
||||
</p>
|
||||
<p>
|
||||
"ae", "Ae", "AE", "ch", "Ch",
|
||||
"CH", "ll", "Ll", "LL", "ss",
|
||||
"Ss", "SS", "nj", "Nj", "NJ",
|
||||
"dz", "Dz", "DZ", "lj", "Lj",
|
||||
"LJ".
|
||||
</p>
|
||||
<p>
|
||||
So for example the expression:
|
||||
</p>
|
||||
<pre class="programlisting">[[.ae.]-c] </pre>
|
||||
<p>
|
||||
will match any character that collates between the digraph "ae"
|
||||
and the character "c".
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../collating_names.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="posix_symbolic_names.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Named Unicode Characters</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../collating_names.html" title="Collating Names">
|
||||
<link rel="prev" href="posix_symbolic_names.html" title="POSIX Symbolic Names">
|
||||
<link rel="next" href="../leftmost_longest_rule.html" title="The Leftmost Longest Rule">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix_symbolic_names.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../leftmost_longest_rule.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.syntax.collating_names.named_unicode"></a><a href="named_unicode.html" title="Named Unicode Characters">
|
||||
Named Unicode Characters</a></h4></div></div></div>
|
||||
<p>
|
||||
When using <a href="../../unicode.html" title="Unicode and Boost.Regex">Unicode aware regular expressions</a>
|
||||
(with the <code class="computeroutput"><span class="identifier">u32regex</span></code> type),
|
||||
all the normal symbolic names for Unicode characters (those given in Unidata.txt)
|
||||
are recognised. So for example:
|
||||
</p>
|
||||
<pre class="programlisting">[[.CYRILLIC CAPITAL LETTER I.]] </pre>
|
||||
<p>
|
||||
would match the Unicode character 0x0418.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="posix_symbolic_names.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../leftmost_longest_rule.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,980 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>POSIX Symbolic Names</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../collating_names.html" title="Collating Names">
|
||||
<link rel="prev" href="digraphs.html" title="Digraphs">
|
||||
<link rel="next" href="named_unicode.html" title="Named Unicode Characters">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="digraphs.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="named_unicode.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="boost_regex.syntax.collating_names.posix_symbolic_names"></a><a href="posix_symbolic_names.html" title="POSIX Symbolic Names">
|
||||
POSIX Symbolic Names</a></h4></div></div></div>
|
||||
<p>
|
||||
The following symbolic names are recognised as valid collating element
|
||||
names, in addition to any single character, this allows you to write for
|
||||
example:
|
||||
</p>
|
||||
<pre class="programlisting">[[.left-square-bracket.][.right-square-bracket.]]</pre>
|
||||
<p>
|
||||
if you wanted to match either "[" or "]".
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Character
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
NUL
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x00
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
SOH
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x01
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
STX
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x02
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ETX
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x03
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
EOT
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x04
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ENQ
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x05
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ACK
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x06
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
alert
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x07
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
backspace
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x08
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
tab
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\t
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
newline
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\n
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
vertical-tab
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\v
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
form-feed
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\f
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
carriage-return
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\r
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
SO
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\xE
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
SI
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\xF
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DLE
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x10
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DC1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x11
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DC2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x12
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DC3
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x13
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DC4
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x14
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
NAK
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x15
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
SYN
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x16
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ETB
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x17
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
CAN
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x18
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
EM
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x19
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
SUB
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1A
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ESC
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1B
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
IS4
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1C
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
IS3
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1D
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
IS2
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1E
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
IS1
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x1F
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
space
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x20
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
exclamation-mark
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
!
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
quotation-mark
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
"
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
number-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
#
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
dollar-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
$
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
percent-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
%
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
ampersand
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
&
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
apostrophe
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
'
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
left-parenthesis
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
(
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
right-parenthesis
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
asterisk
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
*
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
plus-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
+
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
comma
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
,
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
hyphen
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
-
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
period
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
slash
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
/
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
zero
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
0
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
one
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
1
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
two
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
2
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
three
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
3
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
four
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
4
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
five
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
5
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
six
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
6
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
seven
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
7
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
eight
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
8
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
nine
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
9
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
colon
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
:
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
semicolon
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
;
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
less-than-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
equals-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
=
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
greater-than-sign
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
question-mark
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
?
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
commercial-at
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
left-square-bracket
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
[
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
backslash
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
right-square-bracket
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
circumflex
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
~
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
underscore
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
_
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
grave-accent
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
`
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
left-curly-bracket
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
{
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
vertical-line
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
|
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
right-curly-bracket
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
tilde
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
~
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
DEL
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
\x7F
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="digraphs.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../collating_names.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="named_unicode.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>The Leftmost Longest Rule</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../syntax.html" title="Regular Expression Syntax">
|
||||
<link rel="prev" href="collating_names/named_unicode.html" title="Named Unicode Characters">
|
||||
<link rel="next" href="../format.html" title="Search and Replace Format String Syntax">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="collating_names/named_unicode.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.syntax.leftmost_longest_rule"></a><a href="leftmost_longest_rule.html" title="The Leftmost Longest Rule"> The Leftmost
|
||||
Longest Rule</a></h3></div></div></div>
|
||||
<p>
|
||||
Often there is more than one way of matching a regular expression at a particular
|
||||
location, for POSIX basic and extended regular expressions, the "best"
|
||||
match is determined as follows:
|
||||
</p>
|
||||
<div class="orderedlist"><ol type="1">
|
||||
<li>
|
||||
Find the leftmost match, if there is only one match possible at this location
|
||||
then return it.
|
||||
</li>
|
||||
<li>
|
||||
Find the longest of the possible matches, along with any ties. If there
|
||||
is only one such possible match then return it.
|
||||
</li>
|
||||
<li>
|
||||
If there are no marked sub-expressions, then all the remaining alternatives
|
||||
are indistinguishable; return the first of these found.
|
||||
</li>
|
||||
<li>
|
||||
Find the match which has matched the first sub-expression in the leftmost
|
||||
position, along with any ties. If there is only on such match possible
|
||||
then return it.
|
||||
</li>
|
||||
<li>
|
||||
Find the match which has the longest match for the first sub-expression,
|
||||
along with any ties. If there is only one such match then return it.
|
||||
</li>
|
||||
<li>
|
||||
Repeat steps 4 and 5 for each additional marked sub-expression.
|
||||
</li>
|
||||
<li>
|
||||
If there is still more than one possible match remaining, then they are
|
||||
indistinguishable; return the first one found.
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="collating_names/named_unicode.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../format.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Unicode and Boost.Regex</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="../index.html" title="Boost.Regex">
|
||||
<link rel="up" href="../index.html" title="Boost.Regex">
|
||||
<link rel="prev" href="introduction_and_overview.html" title="Introduction and Overview">
|
||||
<link rel="next" href="captures.html" title="Understanding Marked Sub-Expressions and Captures">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="introduction_and_overview.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="captures.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_regex.unicode"></a><a href="unicode.html" title="Unicode and Boost.Regex"> Unicode and Boost.Regex</a></h2></div></div></div>
|
||||
<p>
|
||||
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="id502050"></a>
|
||||
<a href="unicode.html#boost_regex.unicode.rely_on_wchar_t">Rely on wchar_t</a>
|
||||
</h5>
|
||||
<p>
|
||||
If your platform's <code class="computeroutput"><span class="keyword">wchar_t</span></code> type
|
||||
can hold Unicode strings, and your platform's C/C++ runtime correctly handles
|
||||
wide character constants (when passed to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iswspace</span></code>
|
||||
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iswlower</span></code> etc), then you can use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">wregex</span></code>
|
||||
to process Unicode. However, there are several disadvantages to this approach:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li>
|
||||
It's not portable: there's no guarantee on the width of <code class="computeroutput"><span class="keyword">wchar_t</span></code>,
|
||||
or even whether the runtime treats wide characters as Unicode at all, most
|
||||
Windows compilers do so, but many Unix systems do not.
|
||||
</li>
|
||||
<li>
|
||||
There's no support for Unicode-specific character classes: <code class="computeroutput"><span class="special">[[:</span><span class="identifier">Nd</span><span class="special">:]]</span></code>,
|
||||
<code class="computeroutput"><span class="special">[[:</span><span class="identifier">Po</span><span class="special">:]]</span></code> etc.
|
||||
</li>
|
||||
<li>
|
||||
You can only search strings that are encoded as sequences of wide characters,
|
||||
it is not possible to search UTF-8, or even UTF-16 on many platforms.
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_regex.unicode.use_a_unicode_aware_regular_expression_type_"></a><h5>
|
||||
<a name="id502232"></a>
|
||||
<a href="unicode.html#boost_regex.unicode.use_a_unicode_aware_regular_expression_type_">Use
|
||||
a Unicode Aware Regular Expression Type.</a>
|
||||
</h5>
|
||||
<p>
|
||||
If you have the <a href="http://www.ibm.com/software/globalization/icu/" target="_top">ICU
|
||||
library</a>, then Boost.Regex can be <a href="install.html#boost_regex.install.building_with_unicode_and_icu_support">configured
|
||||
to make use of it</a>, and provide a distinct regular expression type (boost::u32regex),
|
||||
that supports both Unicode specific character properties, and the searching
|
||||
of text that is encoded in either UTF-8, UTF-16, or UTF-32. See: <a href="ref/non_std_strings/icu.html" title="Working With Unicode and ICU String Types">ICU
|
||||
string class support</a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><small>Copyright © 2007 John Maddock</small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="introduction_and_overview.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="captures.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,211 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Boost.Regex</title>
|
||||
<link rel="stylesheet" href="../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_2006-12-17_0120">
|
||||
<link rel="start" href="index.html" title="Boost.Regex">
|
||||
<link rel="next" href="boost_regex/configuration.html" title="Configuration">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%">
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../index.htm">Home</a></td>
|
||||
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="../../../../people/people.htm">People</a></td>
|
||||
<td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../more/index.htm">More</a></td>
|
||||
</table>
|
||||
<hr>
|
||||
<div class="spirit-nav"><a accesskey="n" href="boost_regex/configuration.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
|
||||
<div class="article" lang="en">
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><h2 class="title">
|
||||
<a name="boost_regex"></a>Boost.Regex</h2></div>
|
||||
<div><div class="authorgroup"><div class="author"><h3 class="author">
|
||||
<span class="firstname">John</span> <span class="surname">Maddock</span>
|
||||
</h3></div></div></div>
|
||||
<div><p class="copyright">Copyright © 2007 John Maddock</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id428465"></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>
|
||||
</div></div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="toc">
|
||||
<p><b>Table of Contents</b></p>
|
||||
<dl>
|
||||
<dt><span class="section"><a href="boost_regex/configuration.html"> Configuration</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/configuration/compiler.html"> Compiler Setup</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/configuration/locale.html"> Locale and traits
|
||||
class selection</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/configuration/linkage.html"> Linkage Options</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/configuration/algorithm.html"> Algorithm Selection</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/configuration/tuning.html"> Algorithm Tuning</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/install.html"> Building and Installing the Library</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/introduction_and_overview.html">Introduction and
|
||||
Overview</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/unicode.html"> Unicode and Boost.Regex</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/captures.html"> Understanding Marked Sub-Expressions
|
||||
and Captures</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/partial_matches.html"> Partial Matches</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax.html"> Regular Expression Syntax</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/perl_syntax.html"> Perl Regular Expression
|
||||
Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/basic_extended.html"> POSIX Extended Regular
|
||||
Expression Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/basic_syntax.html"> POSIX Basic Regular
|
||||
Expression Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/character_classes.html"> Character Class
|
||||
Names</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/character_classes/std_char_clases.html">
|
||||
Character Classes that are Always Supported</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/character_classes/optional_char_class_names.html">
|
||||
Character classes that are supported by Unicode Regular Expressions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/collating_names.html"> Collating Names</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/collating_names/digraphs.html"> Digraphs</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/collating_names/posix_symbolic_names.html">
|
||||
POSIX Symbolic Names</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/collating_names/named_unicode.html">
|
||||
Named Unicode Characters</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/syntax/leftmost_longest_rule.html"> The Leftmost
|
||||
Longest Rule</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/format.html"> Search and Replace Format String Syntax</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/format/sed_format.html"> Sed Format String Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/format/perl_format.html"> Perl Format String Syntax</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/format/boost_format_syntax.html"> Boost-Extended
|
||||
Format String Syntax</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/ref.html"> Reference</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/basic_regex.html"> basic_regex</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/match_results.html"> match_results</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/sub_match.html"> sub_match</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_match.html"> regex_match</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_search.html"> regex_search</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_replace.html"> regex_replace</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_iterator.html"> regex_iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_token_iterator.html"> regex_token_iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/bad_expression.html"> bad_expression</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type.html"> syntax_option_type</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_synopsis.html">
|
||||
syntax_option_type Synopsis</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_overview.html">
|
||||
Overview of syntax_option_type</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_perl.html">
|
||||
Options for Perl Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_extended.html">
|
||||
Options for POSIX Extended Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_basic.html">
|
||||
Options for POSIX Basic Regular Expressions</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/syntax_option_type/syntax_option_type_literal.html">
|
||||
Options for Literal Strings</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/ref/match_flag_type.html"> match_flag_type</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/error_type.html"> error_type</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/regex_traits.html"> regex_traits</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings.html"> Interfacing With Non-Standard
|
||||
String Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/icu.html"> Working With
|
||||
Unicode and ICU String Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/icu/intro.html"> Introduction
|
||||
to using Regex with ICU</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/icu/unicode_types.html">
|
||||
Unicode regular expression types</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/icu/unicode_algo.html">
|
||||
Unicode Regular Expression Algorithms</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/icu/unicode_iter.html">
|
||||
Unicode Aware Regex Iterators</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings.html"> Using
|
||||
Boost Regex With MFC Strings</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings/mfc_intro.html">
|
||||
Introduction to Boost.Regex and MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_types.html">
|
||||
Regex Types Used With MFC Strings</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_create.html">
|
||||
Regular Expression Creation From an MFC String</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html">
|
||||
Overloaded Algorithms For MFC String Types</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html">
|
||||
Iterating Over the Matches Within An MFC String</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/ref/posix.html"> POSIX Compatible C API's</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/concepts.html"> Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/concepts/charT_concept.html"> charT Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/concepts/traits_concept.html"> Traits Class
|
||||
Requirements</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/concepts/iterator_concepts.html"> Iterator
|
||||
Rrequirements</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/ref/deprecated_interfaces.html">Deprecated Interfaces</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/ref/deprecated_interfaces/regex_format.html">
|
||||
regex_format (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/deprecated_interfaces/regex_grep.html">
|
||||
regex_grep (Deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/deprecated_interfaces/regex_split.html">
|
||||
regex_split (deprecated)</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/ref/deprecated_interfaces/old_regex.html"> High
|
||||
Level Class RegEx (Deprecated)</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_regex/background_information.html">Background Information</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/headers.html"> Headers</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/locale.html"> Localization</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/thread_safety.html"> Thread
|
||||
Safety</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/examples.html"> Test and
|
||||
Example Programs</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/futher.html"> References
|
||||
and Further Information</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/faq.html"> FAQ</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/performance.html"> Performance</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/standards.html"> Standards
|
||||
Conformance</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/redist.html"> Redistributables</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/acknowledgements.html">
|
||||
Acknowledgements</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_regex/background_information/history.html"> History</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><small><p>Last revised: June 08, 2007 at 09:14:36 GMT</p></small></td>
|
||||
<td align="right"><small></small></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"><a accesskey="n" href="boost_regex/configuration.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user