mirror of
https://github.com/boostorg/regex.git
synced 2025-07-21 08:12:37 +02:00
Merged regex-4 branch.
[SVN r18430]
This commit is contained in:
82
doc/Attic/bad_expression.html
Normal file
82
doc/Attic/bad_expression.html
Normal file
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: bad_expression</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">class bad_expression</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>Synopsis</h3>
|
||||
<p>#include <<a href="../../boost/regex/pattern_except.hpp">boost/pattern_except.hpp</a>></p>
|
||||
<p>The class <code>bad_expression</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>
|
||||
<b>namespace</b> boost{
|
||||
|
||||
<b>class</b> bad_pattern : <b>public</b> std::runtime_error
|
||||
{
|
||||
<b>public</b>:
|
||||
<b>explicit</b> bad_pattern(<b>const</b> std::string& s) : std::runtime_error(s){};
|
||||
};
|
||||
|
||||
<b>class</b> bad_expression : <b>public</b> bad_pattern
|
||||
{
|
||||
<b>public</b>:
|
||||
bad_expression(<b>const</b> std::string& s) : bad_pattern(s) {}
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost
|
||||
</pre>
|
||||
<h3>Description</h3>
|
||||
<pre>
|
||||
bad_expression(const string& what_arg);
|
||||
</pre>
|
||||
<p><b>Effects:</b> Constructs an object of class <code>bad_expression</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Postcondition:</b> <code>strcmp(what(), what_arg.c_str()) == 0</code>.</p>
|
||||
<p>Footnotes: the class <i>bad_pattern</i> forms the base class for all
|
||||
pattern-matching exceptions, of which <i>bad_expression</i> is one. The choice
|
||||
of <i>std::runtime_error</i> as the base class for <i>bad_pattern</i> 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).</p>
|
||||
<p></p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
1293
doc/Attic/basic_regex.html
Normal file
1293
doc/Attic/basic_regex.html
Normal file
File diff suppressed because it is too large
Load Diff
232
doc/Attic/configuration.html
Normal file
232
doc/Attic/configuration.html
Normal file
@ -0,0 +1,232 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Configuration and setup</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Configuration and setup</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2>Contents</h2>
|
||||
|
||||
<dl class="index">
|
||||
<dt><a href="#compiler">Compiler setup</a></dt>
|
||||
|
||||
<dt><a href="#locale">Locale and traits class selection</a></dt>
|
||||
|
||||
<dt><a href="#linkage">Linkage Options</a></dt>
|
||||
|
||||
<dt><a href="#algorithm">Algorithm Selection</a></dt>
|
||||
|
||||
<dt><a href="#tuning">Algorithm Tuning</a></dt>
|
||||
</dl>
|
||||
|
||||
<h3><a name="compiler"></a>Compiler setup.</h3>
|
||||
|
||||
<p>You shouldn't need to do anything special to configure
|
||||
boost.regex for use with your compiler - the <a href="../../config/index.html">boost.config</a> subsystem 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">boost.config</a> has a <a href="../../config/config.htm#config_script">configure</a> script.</p>
|
||||
|
||||
<h3><a name="locale"></a>Locale and traits class selection.</h3>
|
||||
|
||||
<p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) control how
|
||||
boost.regex interacts with the user's locale:</p>
|
||||
|
||||
<table id="Table2" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_C_LOCALE</td>
|
||||
<td>Forces boost.regex to use the global C locale in its traits
|
||||
class support: this is the default behavior on non-windows
|
||||
platforms, but MS Windows platforms normally use the Win32 API for
|
||||
locale support.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
|
||||
<td>Forces boost.regex to use std::locale in it's default traits
|
||||
class, regular expressions can then be imbued with an
|
||||
instance specific locale.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_NO_W32</td>
|
||||
<td>Tells boost.regex not to use any Win32 API's even when
|
||||
available (implies BOOST_REGEX_USE_C_LOCALE unless
|
||||
BOOST_REGEX_USE_CPP_LOCALE is set).</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="linkage"></a>Linkage Options</h3>
|
||||
|
||||
<table id="Table3" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_DYN_LINK</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_NO_LIB</td>
|
||||
<td>For Microsoft and Borland C++ builds, this tells boost.regex
|
||||
that it should not automatically select the library to link
|
||||
to.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="algorithm"></a>Algorithm Selection</h3>
|
||||
|
||||
<table id="Table4" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_V3</td>
|
||||
<td>Tells boost.regex to use the boost-1.30.0 matching algorithm,
|
||||
define only if you need maximum compatibility with previous
|
||||
behavior.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_RECURSIVE</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_NON_RECURSIVE</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="tuning"></a>Algorithm Tuning</h3>
|
||||
|
||||
<p>The following option applies only if BOOST_REGEX_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<table id="Table6" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_HAS_MS_STACK_GUARD</td>
|
||||
<td>Tells boost.regex that Microsoft style __try - __except blocks
|
||||
are supported, and can be used to safely trap stack overflow.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>The following options apply only if BOOST_REGEX_NON_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<table id="Table5" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_BLOCKSIZE</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_BLOCKS</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_CACHE_BLOCKS</td>
|
||||
<td>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.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
110
doc/Attic/contacts.html
Normal file
110
doc/Attic/contacts.html
Normal file
@ -0,0 +1,110 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Contacts</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1" >
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Contacts and Acknowledgements</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>The author can be contacted at <a href="mailto:john_maddock@compuserve.com">
|
||||
john_maddock@compuserve.com</a>, the home page for this library is
|
||||
at <a href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
|
||||
http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm</a>,
|
||||
and the official boost version can be obtained from <a href="../libraries.htm">www.boost.org/libraries.htm</a>.</p>
|
||||
|
||||
<p>I am indebted to Robert Sedgewick's "Algorithms in C++" for
|
||||
forcing me to think about algorithms and their performance, and to
|
||||
the folks at boost for forcing me to <i>think</i>, period. 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<72> Poirier, Michael Raykh, Marc Recht, Scott
|
||||
VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
|
||||
the manuals supplied with the Henry Spencer, 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>
|
||||
|
||||
<p>Useful further information can be found at:</p>
|
||||
|
||||
<p>A short tutorial on regular expressions <a href="http://www.devshed.com/Server_Side/Administration/RegExp/">can be
|
||||
found here</a>.</p>
|
||||
|
||||
<p>The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
|
||||
Specification</a> contains a wealth of useful material, including
|
||||
the regular expression syntax, and specifications for <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
|
||||
<regex.h></a> and <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
|
||||
<nl_types.h></a>.</p>
|
||||
|
||||
<p>The <a href="http://www.cs.ucr.edu/~stelo/pattern.html">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/">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">Udi Manber</a>
|
||||
and <a href="http://www.dcc.uchile.cl/~rbaeza/">Ricardo
|
||||
Baeza-Yates</a> both have a selection of useful pattern matching
|
||||
papers available from their respective web sites.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
99
doc/Attic/examples.html
Normal file
99
doc/Attic/examples.html
Normal file
@ -0,0 +1,99 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Examples</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">Examples</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<BR>
|
||||
<BR>
|
||||
<HR>
|
||||
<P>There are three demo applications that ship with this library, they all come
|
||||
with makefiles for Borland, Microsoft and gcc compilers, otherwise you will
|
||||
have to create your own makefiles.</P>
|
||||
<H5>regress.exe:</H5>
|
||||
<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>Files: <A href="../test/regress/parse.cpp">parse.cpp</A>, <A href="../test/regress/regress.cpp">
|
||||
regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.</P>
|
||||
<H5>jgrep.exe</H5>
|
||||
<P>A simple grep implementation, run with no command line options to find out its
|
||||
usage. Look at <A href="../src/fileiter.cpp">fileiter.cpp</A>/fileiter.hpp and
|
||||
the mapfile class to see an example of a "smart" bidirectional iterator that
|
||||
can be used with boost.regex or any other STL algorithm.</P>
|
||||
<P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp">
|
||||
main.cpp</A>.</P>
|
||||
<H5>timer.exe</H5>
|
||||
<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">regex_timer.cpp</A>.</P>
|
||||
<H5>Code snippets</H5>
|
||||
<P>The snippets examples contain the code examples used in the documentation:</P>
|
||||
<P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
|
||||
Credit card number formatting code.</P>
|
||||
<P><A href="../example/snippets/partial_regex_grep.cpp">partial_regex_grep.cpp</A>:
|
||||
Search example using partial matches.</P>
|
||||
<P><A href="../example/snippets/partial_regex_match.cpp">partial_regex_match.cpp</A>:
|
||||
regex_match example using partial matches.</P>
|
||||
<P><A href="../example/snippets/regex_grep_example_1.cpp">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">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">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">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_match_example.cpp">regex_match_example.cpp</A>:
|
||||
ftp based regex_match example.</P>
|
||||
<P><A href="../example/snippets/regex_merge_example.cpp">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">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">regex_search_example.cpp</A>:
|
||||
regex_search example: searches a cpp file for class definitions.</P>
|
||||
<P><A href="../example/snippets/regex_split_example_1.cpp">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">regex_split_example_2.cpp</A>
|
||||
: regex_split example: spit out linked URL's.</P>
|
||||
<P></P>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
162
doc/Attic/faq.html
Normal file
162
doc/Attic/faq.html
Normal file
@ -0,0 +1,162 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: FAQ</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">FAQ</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<font color="#ff0000"><font color="#ff0000"></font></font>
|
||||
<p><font color="#ff0000"><font color="#ff0000"><font color=
|
||||
"#ff0000"> Q. Why can't I use the "convenience" versions of
|
||||
regex_match / regex_search / regex_grep / regex_format /
|
||||
regex_merge?</font></font></font></p>
|
||||
|
||||
<p>A. 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.<font color="#ff0000"><font color=
|
||||
"#ff0000"></font></font></p>
|
||||
|
||||
<p><font color="#ff0000"><font color="#ff0000">Q. I can't get
|
||||
regex++ to work with escape characters, what's going
|
||||
on?</font></font></p>
|
||||
|
||||
<p>A. 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 regex++ expression compiler, so to pass
|
||||
the regular expression \d+ to regex++, you need to embed "\\d+" in
|
||||
your code. Likewise to match a literal backslash you will need to
|
||||
embed "\\\\" in your code. <font color="#ff0000"></font></p>
|
||||
|
||||
<p><font color="#ff0000">Q. Why does using parenthesis in a POSIX
|
||||
regular expression change the result of a match?</font></p>
|
||||
|
||||
<p>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>
|
||||
|
||||
<pre>
|
||||
"(0*)([0-9]*)" against "00123" would produce
|
||||
$1 = "00"
|
||||
$2 = "123"
|
||||
</pre>
|
||||
|
||||
<p>where as</p>
|
||||
|
||||
<pre>
|
||||
"0*([0-9)*" against "00123" would produce
|
||||
$1 = "00123"
|
||||
</pre>
|
||||
|
||||
<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>
|
||||
|
||||
<pre>
|
||||
"0*([1-9][0-9]*)"
|
||||
</pre>
|
||||
|
||||
<p>as the expression.</p>
|
||||
|
||||
<p><font color="#ff0000">Q. Why don't character ranges work
|
||||
properly (POSIX mode only)?</font><br>
|
||||
A. 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 regex_constants::collate
|
||||
compile time flag. However if you set a non-default compile time
|
||||
flag - for example regex_constants::extended or
|
||||
regex_constants::basic, then locale dependent collation will be
|
||||
enabled, this also applies to the POSIX API functions which use
|
||||
either regex_constants::extended or regex_constants::basic
|
||||
internally. <i>[Note - when regex_constants::nocollate in effect,
|
||||
the library behaves "as if" the LC_COLLATE locale category were
|
||||
always "C", regardless of what its actually set to - end
|
||||
note</i>].</p>
|
||||
|
||||
<p><font color="#ff0000">Q. Why are there no throw specifications
|
||||
on any of the functions? What exceptions can the library
|
||||
throw?</font></p>
|
||||
|
||||
<p>A. 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::bad_expression can be thrown by basic_regex when
|
||||
compiling a regular expression, std::runtime_error can be thrown
|
||||
when a call to basic_regex::imbue tries to open a message catalogue
|
||||
that doesn't exist, or when a call to regex_search or regex_match
|
||||
results in an "everlasting" search, or when a call to
|
||||
RegEx::GrepFiles or RegEx::FindFiles tries to open a file that
|
||||
cannot be opened, finally std::bad_alloc can be thrown by just
|
||||
about any of the functions in this library.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
272
doc/Attic/format_syntax.html
Normal file
272
doc/Attic/format_syntax.html
Normal file
@ -0,0 +1,272 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: Format String Syntax</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Format String Syntax</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>Format strings are used by the algorithm <a href="template_class_ref.htm#reg_merge">regex_merge</a> and by <a
|
||||
href="match_results.html">match_results::format</a>, and are used
|
||||
to transform one string into another.</p>
|
||||
|
||||
<p>There are three kind of format string: sed, Perl and extended,
|
||||
the extended syntax is a superset of the others so this is covered
|
||||
first.</p>
|
||||
|
||||
<p><b><i>Extended format syntax</i></b></p>
|
||||
|
||||
<p>In format strings, all characters are treated as literals
|
||||
except: ()$\?:</p>
|
||||
|
||||
<p>To use any of these as literals you must prefix them with the
|
||||
escape character \</p>
|
||||
|
||||
<p>The following special sequences are recognized: <br>
|
||||
<br>
|
||||
<i>Grouping:</i></p>
|
||||
|
||||
<p>Use the parenthesis characters ( and ) to group sub-expressions
|
||||
within the format string, use \( and \) to represent literal '('
|
||||
and ')'. <br>
|
||||
<br>
|
||||
<i>Sub-expression expansions:</i></p>
|
||||
|
||||
<p>The following Perl like expressions expand to a particular
|
||||
matched sub-expression:<br>
|
||||
</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="0" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">$`</td>
|
||||
<td valign="top" width="43%">Expands to all the text from the end
|
||||
of the previous match to the start of the current match, if there
|
||||
was no previous match in the current operation, then everything
|
||||
from the start of the input string to the start of the match.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">$'</td>
|
||||
<td valign="top" width="43%">Expands to all the text from the end
|
||||
of the match to the end of the input string.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">$&</td>
|
||||
<td valign="top" width="43%">Expands to all of the current
|
||||
match.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">$0</td>
|
||||
<td valign="top" width="43%">Expands to all of the current
|
||||
match.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">$N</td>
|
||||
<td valign="top" width="43%">Expands to the text that matched
|
||||
sub-expression <i>N</i>.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p><i>Conditional expressions:</i></p>
|
||||
|
||||
<p>Conditional expressions allow two different format strings to be
|
||||
selected dependent upon whether a sub-expression participated in
|
||||
the match or not:</p>
|
||||
|
||||
<p>?Ntrue_expression:false_expression</p>
|
||||
|
||||
<p>Executes true_expression if sub-expression <i>N</i> participated
|
||||
in the match, otherwise executes false_expression.</p>
|
||||
|
||||
<p>Example: suppose we search for "(while)|(for)" then the format
|
||||
string "?1WHILE:FOR" would output what matched, but in upper
|
||||
case. <br>
|
||||
<br>
|
||||
<i>Escape sequences:</i></p>
|
||||
|
||||
<p>The following escape sequences are also allowed:<br>
|
||||
</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table3" cellspacing="0" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\a</td>
|
||||
<td valign="top" width="43%">The bell character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\f</td>
|
||||
<td valign="top" width="43%">The form feed character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\n</td>
|
||||
<td valign="top" width="43%">The newline character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\r</td>
|
||||
<td valign="top" width="43%">The carriage return character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\t</td>
|
||||
<td valign="top" width="43%">The tab character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\v</td>
|
||||
<td valign="top" width="43%">A vertical tab character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\x</td>
|
||||
<td valign="top" width="43%">A hexadecimal character - for example
|
||||
\x0D.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\x{}</td>
|
||||
<td valign="top" width="43%">A possible Unicode hexadecimal
|
||||
character - for example \x{1A0}</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\cx</td>
|
||||
<td valign="top" width="43%">The ASCII escape character x, for
|
||||
example \c@ is equivalent to escape-@.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\e</td>
|
||||
<td valign="top" width="43%">The ASCII escape character.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="8%"> </td>
|
||||
<td valign="top" width="40%">\dd</td>
|
||||
<td valign="top" width="43%">An octal character constant, for
|
||||
example \10.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p><b><i>Perl format strings</i></b></p>
|
||||
|
||||
<p>Perl format strings are the same as the default syntax except
|
||||
that the characters ()?: have no special meaning.</p>
|
||||
|
||||
<p><b><i>Sed format strings</i></b></p>
|
||||
|
||||
<p>Sed format strings use only the characters \ and & as
|
||||
special characters.</p>
|
||||
|
||||
<p>\n where n is a digit, is expanded to the nth
|
||||
sub-expression.</p>
|
||||
|
||||
<p>& is expanded to the whole of the match (equivalent to
|
||||
\0).</p>
|
||||
|
||||
<p>Other escape sequences are expanded as per the default
|
||||
syntax.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
52
doc/Attic/headers.html
Normal file
52
doc/Attic/headers.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Headers</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Headers</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>There are two main headers used by this library: <boost/regex.hpp>
|
||||
provides full access to the entire library, while <boost/cregex.hpp>
|
||||
provides access to just the high level class RegEx, and the POSIX API
|
||||
functions.
|
||||
</P>
|
||||
<P>There is also a header containing only forward declarations
|
||||
<boost/regex_fwd.hpp> for use when an interface is dependent upon
|
||||
boost::basic_regex, but otherwise does not need the full definitions.</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
58
doc/Attic/history.html
Normal file
58
doc/Attic/history.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: History</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">History</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Boost 1.31.0.</P>
|
||||
<UL>
|
||||
<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 <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">
|
||||
regular expression standardization proposal</A>.</LI>
|
||||
<LI>
|
||||
Added regex_iterator and regex_token_iterator.</LI>
|
||||
<LI>
|
||||
Added support for Perl style independent sub-expressions.</LI></UL>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
45
doc/Attic/implementation.html
Normal file
45
doc/Attic/implementation.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Implementation</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Implementation</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Todo.</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
237
doc/Attic/install.html
Normal file
237
doc/Attic/install.html
Normal file
@ -0,0 +1,237 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Index</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Installation</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P><EM>[ </EM><STRONG><I>Important</I></STRONG><EM>: If you are upgrading from the
|
||||
2.x version of this library then you will find a number of changes to the
|
||||
documented header names and library interfaces, existing code should still
|
||||
compile unchanged however - see </EM><A href="appendix.htm#upgrade"><FONT color="#0000ff">
|
||||
<EM>Note for Upgraders</EM></FONT></A><EM>. ]</EM></P>
|
||||
<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/config.htm">
|
||||
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>
|
||||
<P><B><A name="bcb"></A>Borland C++ Builder:</B>
|
||||
</P>
|
||||
<UL>
|
||||
<LI>
|
||||
Open up a console window and change to the <boost>\libs\regex\build
|
||||
directory.
|
||||
<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>
|
||||
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>
|
||||
<PRE>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>
|
||||
<P>make -fbcb5.mak install</P>
|
||||
<P>library files will be copied to <BCROOT>/lib and the dll's to
|
||||
<BCROOT>/bin, where <BCROOT> 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>
|
||||
<P>make -fbcb5.mak clean</P>
|
||||
<P>Finally when you use regex++ it is only necessary for you to add the
|
||||
<boost> 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 static link to the regex libraries even when using
|
||||
the dll runtime then define BOOST_REGEX_STATIC_LINK, and 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
|
||||
<boost/regex.hpp> can not be used in a pre-compiled header (the actual
|
||||
problem is in <locale> which gets included by <boost/regex.hpp>),
|
||||
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>
|
||||
<P><B><A name="vc"></A>Microsoft Visual C++ 6</B><STRONG> and 7</STRONG></P>
|
||||
<P>You need version 6 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 <A href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
|
||||
library</A>
|
||||
</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 <boost>\libs\regex\build
|
||||
directory.
|
||||
</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>
|
||||
<P>nmake -fvc6.mak</P>
|
||||
<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>
|
||||
<P>nmake -fvc6.mak install</P>
|
||||
<P>The lib files will be copied to your <VC6>\lib directory and the dll
|
||||
files to <VC6>\bin, where <VC6> 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>
|
||||
<P>nmake -fvc6.mak clean
|
||||
</P>
|
||||
<P>Finally when you use regex++ it is only necessary for you to add the
|
||||
<boost> 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 statically link to the regex library when using the
|
||||
dynamic C++ runtime, define BOOST_REGEX_STATIC_LINK when building your project
|
||||
(this only has an effect for release builds). If you want to add the source
|
||||
directly to your project then define BOOST_REGEX_NO_LIB to disable automatic
|
||||
library selection.</P>
|
||||
<P><STRONG><I>Important</I></STRONG><EM>: 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.</EM></P>
|
||||
<P>Note: 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. Alternatively if STLPort is in c:/stlport then
|
||||
you could use:</P>
|
||||
<P>nmake INCLUDES="-Ic:/stlport/stlport" XLFLAGS="/LIBPATH:c:/stlport/lib"
|
||||
-fvc6-stlport.mak</P>
|
||||
<P>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).
|
||||
<BR>
|
||||
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P><B><A name="gcc"></A>GCC(2.95 and 3.x)</B>
|
||||
</P>
|
||||
<P>There is a conservative makefile for the g++ compiler. From the command prompt
|
||||
change to the <boost>/libs/regex/build directory and type:
|
||||
</P>
|
||||
<P>make -fgcc.mak
|
||||
</P>
|
||||
<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>
|
||||
<P>make -fgcc-shared.mak</P>
|
||||
<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>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
|
||||
<boost>/libs/config; see the <A href="../config/config.htm">config library
|
||||
documentation</A>.</P>
|
||||
<P><B><A name="sun"></A>Sun Workshop 6.1</B></P>
|
||||
<P>There is a makefile for the sun (6.1) compiler (C++ version 3.12). From the
|
||||
command prompt change to the <boost>/libs/regex/build directory and type:
|
||||
</P>
|
||||
<P>dmake -f sunpro.mak
|
||||
</P>
|
||||
<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 regex++, you will need to add the boost install
|
||||
directory to your list of include paths and add
|
||||
<boost>/libs/regex/build/sunpro/ 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>
|
||||
<P>dmake CXXFLAGS="-xarch=v9" LDFLAGS="-xarch=v9" LIBSUFFIX="_v9" -f sunpro.mak</P>
|
||||
<P>will build v9 variants of the regex library named libboost_regex_v9.a etc.</P>
|
||||
<P><B><A name="other"></A>Other compilers:</B>
|
||||
</P>
|
||||
<P>There is a generic makefile (<A href="build/generic.mak">generic.mak</A>)
|
||||
provided in <boost-root>/libs/regex/build - see that makefile for details
|
||||
of environment variables that need to be set before use. Alternatively you can
|
||||
using the <A href="../../tools/build/index.html">Jam based build system</A>. If
|
||||
you need to configure the library for your platform, then refer to the <A href="../config/config.htm">
|
||||
config library documentation</A>
|
||||
.
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
176
doc/Attic/introduction.html
Normal file
176
doc/Attic/introduction.html
Normal file
@ -0,0 +1,176 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Introduction</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Introduction</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<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 <I>grep</I>, <I>sed</I>
|
||||
and <I>awk</I>, and the programming language <I>Perl</I>, 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 regex++
|
||||
does provide these API's, they do not represent the best way to use the
|
||||
library. For example 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="basic_regex.html">boost::basic_regex</A> is the key class in
|
||||
this library; it represents a "machine readable" regular expression, and is
|
||||
very closely modeled on std::basic_string, think of it as a string plus the
|
||||
actual state-machine required by the regular expression algorithms. Like
|
||||
std::basic_string there are two typedefs that are almost always the means by
|
||||
which this class is referenced:</P>
|
||||
<pre><B>namespace </B>boost{
|
||||
|
||||
<B>template</B> <<B>class</B> charT,
|
||||
<B> class</B> traits = regex_traits<charT>,
|
||||
<B>class</B> Allocator = std::allocator<charT> >
|
||||
<B>class</B> basic_regex;
|
||||
|
||||
<B>typedef</B> basic_regex<<B>char</B>> regex;
|
||||
<B>typedef</B> basic_regex<<B>wchar_t></B> wregex;
|
||||
|
||||
}</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
|
||||
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>
|
||||
<P>(\d{4}[- ]){3}\d{4}</P>
|
||||
<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. 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><B>bool</B> validate_card_format(<B>const</B> std::string s)
|
||||
{
|
||||
<B>static</B> <B>const</B> <A href="basic_regex.html">boost::regex</A> e("(\\d{4}[- ]){3}\\d{4}");
|
||||
<B>return</B> <A href="regex_match.html">regex_match</A>(s, e);
|
||||
}</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 Koenig lookup, if yours doesn't
|
||||
(for example VC6), then you will have to add some boost:: 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 <I>sed</I> and <I>Perl</I> will already be ahead here; we
|
||||
need two strings - one a regular expression - the other a "<A href="format_syntax.html">format
|
||||
string</A>" that provides a description of the text to replace the match
|
||||
with. In regex++ this search and replace operation is performed with the
|
||||
algorithm regex_replace, for our credit card example we can write two algorithms
|
||||
like this to provide the format conversions:</P>
|
||||
<PRE><I>// match any format with the regular expression:
|
||||
</I><B>const</B> boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
|
||||
<B>const</B> std::string machine_format("\\1\\2\\3\\4");
|
||||
<B>const</B> std::string human_format("\\1-\\2-\\3-\\4");
|
||||
|
||||
std::string machine_readable_card_number(<B>const</B> std::string s)
|
||||
{
|
||||
<B>return</B> <A href="regex_replace.html">regex_replace</A>(s, e, machine_format, boost::match_default | boost::format_sed);
|
||||
}
|
||||
|
||||
std::string human_readable_card_number(<B>const</B> std::string s)
|
||||
{
|
||||
<B>return</B> <A href="regex_replace.html">regex_replace</A>(s, e, human_format, boost::match_default | boost::format_sed);
|
||||
}</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="match_results.html">
|
||||
match_results</A>, as before there are typedefs of this class for the most
|
||||
common cases:
|
||||
</P>
|
||||
<PRE><B>namespace </B>boost{
|
||||
<B>typedef</B> match_results<<B>const</B> <B>char</B>*> cmatch;
|
||||
<B>typedef</B> match_results<<B>const</B> <B>wchar_t</B>*> wcmatch;
|
||||
<STRONG>typedef</STRONG> match_results<std::string::const_iterator> smatch;
|
||||
<STRONG>typedef</STRONG> match_results<std::wstring::const_iterator> wsmatch;
|
||||
}</PRE>
|
||||
<P>The algorithms <A href="regex_search.html">regex_search</A> and <A href="regex_grep.html">
|
||||
regex_grep</A> (i.e. finding all matches in a string) make use of
|
||||
match_results to report what 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="regex_replace.html">
|
||||
regex_replace</A> that we have already seen, the algorithm <A href="regex_format.html">
|
||||
regex_format</A> takes the result of a match and a format string, and
|
||||
produces a new string by merging the two.</P>
|
||||
<P>For those that dislike templates, there is a high level wrapper class RegEx
|
||||
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.
|
||||
</P>
|
||||
<P>The <A href="posix_api.html">POSIX API</A> functions: regcomp, regexec, regfree
|
||||
and regerror, 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 run-time <A href="localisation.html">localization</A>
|
||||
support, 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, and to a more limited extent
|
||||
Perl 5.
|
||||
</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
1032
doc/Attic/localisation.html
Normal file
1032
doc/Attic/localisation.html
Normal file
File diff suppressed because it is too large
Load Diff
330
doc/Attic/match_flag_type.html
Normal file
330
doc/Attic/match_flag_type.html
Normal file
@ -0,0 +1,330 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: match_flag_type</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">match_flag_type</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3>Synopsis</h3>
|
||||
|
||||
<p>The type <code>match_flag_type</code> is an implementation
|
||||
defined bitmask type (17.3.2.1.2) that controls how a regular
|
||||
expression is matched against a character sequence.</p>
|
||||
|
||||
<pre>
|
||||
namespace std{ namespace regex_constants{
|
||||
|
||||
typedef bitmask_type match_flag_type;
|
||||
|
||||
static const match_flag_type match_default = 0;
|
||||
static const match_flag_type match_not_bob;
|
||||
static const match_flag_type match_not_eob;
|
||||
static const match_flag_type match_not_bol;
|
||||
static const match_flag_type match_not_eol;
|
||||
static const match_flag_type match_not_bow;
|
||||
static const match_flag_type match_not_eow;
|
||||
static const match_flag_type match_any;
|
||||
static const match_flag_type match_not_null;
|
||||
static const match_flag_type match_continuous;
|
||||
static const match_flag_type match_partial;
|
||||
static const match_flag_type match_prev_avail;
|
||||
static const match_flag_type match_not_dot_newline;
|
||||
static const match_flag_type match_not_dot_null;
|
||||
|
||||
static const match_flag_type format_default = 0;
|
||||
static const match_flag_type format_sed;
|
||||
static const match_flag_type format_perl;
|
||||
static const match_flag_type format_no_copy;
|
||||
static const match_flag_type format_first_only;
|
||||
static const match_flag_type format_all;
|
||||
|
||||
} // namespace regex_constants
|
||||
} // namespace std
|
||||
</pre>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>The type <code>match_flag_type</code> is an implementation
|
||||
defined bitmask type (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>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="1" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>Element</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Effect if set</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_default</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<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 valign="top" width="50%">match_not_bob</td>
|
||||
<td valign="top" width="50%">Specifies that the expression "\A"
|
||||
should not match against the sub-sequence [first,first).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">match_not_eob</td>
|
||||
<td valign="top" width="50%">Specifies that the expressions "\z"
|
||||
and "\Z" should not match against the sub-sequence
|
||||
[last,last).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_not_bol</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression "^" should not be matched against
|
||||
the sub-sequence [first,first).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_not_eol</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression "$" should not be matched against
|
||||
the sub-sequence [last,last).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_not_bow</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression "\b" should not be matched against
|
||||
the sub-sequence [first,first).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_not_eow</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression "\b" should not be matched against
|
||||
the sub-sequence [last,last).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_any</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that if more than one match is possible then any match
|
||||
is an acceptable result.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_not_null</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression can not be matched against an
|
||||
empty sequence.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_continuous</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that the expression must match a sub-sequence that
|
||||
begins at <i>first</i>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_partial</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that if no match can be found, then it is acceptable
|
||||
to return a match [from, last) where from!=last, if there exists
|
||||
some sequence of characters [from,to) of which [from,last) is a
|
||||
prefix, and which would result in a full match.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>match_prev_avail</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that <code>--first</code> is a valid iterator
|
||||
position, when this flag is set then the flags <code>
|
||||
match_not_bol</code> and <code>match_not_bow</code> are ignored by
|
||||
the regular expression algorithms (RE.7) and iterators (RE.8).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">match_not_dot_newline</td>
|
||||
<td valign="top" width="50%">Specifies that the expression "." does
|
||||
not match a newline character.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">match_not_dot_null</td>
|
||||
<td valign="top" width="50%">Specified that the expression "." does
|
||||
not match a character null '\0'.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>format_default</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<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). 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 valign="top" width="50%">
|
||||
<p>format_sed</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<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..</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>format_perl</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>Specifies that when a regular expression match is to be replaced
|
||||
by a new string, that the new string is constructed using an
|
||||
implementation defined superset of 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).</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%" height="32">format_all</td>
|
||||
<td valign="top" width="50%" height="32">Specifies that all syntax
|
||||
extensions are enabled, including conditional
|
||||
(?ddexpression1:expression2) replacements.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>format_no_copy</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<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 valign="top" width="50%">
|
||||
<p>format_first_only</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>When specified during a search and replace operation, then only
|
||||
the first occurrence of the regular expression is replaced.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
511
doc/Attic/match_results.html
Normal file
511
doc/Attic/match_results.html
Normal file
@ -0,0 +1,511 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: class match_results</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">class match_results</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3>Contents</h3>
|
||||
|
||||
<dl class="index">
|
||||
<dt><a href="#synopsis">Synopsis</a></dt>
|
||||
|
||||
<dt><a href="#description">Description</a></dt>
|
||||
</dl>
|
||||
|
||||
<h3><a name="synopsis"></a>Synopsis</h3>
|
||||
|
||||
<p>#include <<a href="../../boost/regex.hpp">boost/regex.hpp</a>></p>
|
||||
|
||||
<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 <i>match_results</i> that acts as an indexed
|
||||
collection of sub-expression matches, each sub-expression match
|
||||
being contained in an object of type <i><a href="sub_match.html">
|
||||
sub_match</a></i> .</p>
|
||||
|
||||
<p>Template class match_results denotes a collection of character
|
||||
sequences representing the result of a regular expression match.
|
||||
Objects of type match_results are passed to the algorithms <a href="regex_match.html">regex_match</a> and <a href="regex_search">
|
||||
regex_search</a>, and are returned by the iterator <a href="regex_iterator.html">regex_iterator</a> . Storage for the
|
||||
collection is allocated and freed as necessary by the member
|
||||
functions of class match_results.</p>
|
||||
|
||||
<p>The template class match_results 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 match_results is most commonly used as one of the
|
||||
typedefs cmatch, wcmatch, smatch, or wsmatch:</p>
|
||||
|
||||
<pre>
|
||||
template <class BidirectionalIterator,
|
||||
class Allocator = allocator<sub_match<BidirectionalIterator> >
|
||||
class match_results;
|
||||
|
||||
typedef match_results<const char*> cmatch;
|
||||
typedef match_results<const wchar_t*> wcmatch;
|
||||
typedef match_results<string::const_iterator> smatch;
|
||||
typedef match_results<wstring::const_iterator> wsmatch;
|
||||
|
||||
template <class BidirectionalIterator,
|
||||
class Allocator = allocator<sub_match<BidirectionalIterator> >
|
||||
class match_results
|
||||
{
|
||||
public:
|
||||
typedef sub_match<BidirectionalIterator> value_type;
|
||||
typedef const value_type& const_reference;
|
||||
typedef const_reference reference;
|
||||
typedef implementation defined const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
|
||||
typedef typename Allocator::size_type size_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit match_results(const Allocator& a = Allocator());
|
||||
match_results(const match_results& m);
|
||||
match_results& operator=(const match_results& m);
|
||||
~match_results();
|
||||
|
||||
// size:
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const;
|
||||
// element access:
|
||||
difference_type length(int sub = 0) const;
|
||||
difference_type position(unsigned int sub = 0) const;
|
||||
string_type str(int sub = 0) const;
|
||||
const_reference operator[](int n) const;
|
||||
|
||||
const_reference prefix() const;
|
||||
|
||||
const_reference suffix() const;
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
// format:
|
||||
template <class OutputIterator>
|
||||
OutputIterator format(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
match_flag_type flags = format_default) const;
|
||||
string_type format(const string_type& fmt,
|
||||
match_flag_type flags = format_default) const;
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
void swap(match_results& that);
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
|
||||
template <class charT, class traits, class BidirectionalIterator, class Allocator>
|
||||
basic_ostream<charT, traits>&
|
||||
operator << (basic_ostream<charT, traits>& os,
|
||||
const match_results<BidirectionalIterator, Allocator>& m);
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
match_results<BidirectionalIterator, Allocator>& m2);
|
||||
</pre>
|
||||
|
||||
<h3><a name="description"></a>Description</h3>
|
||||
|
||||
<h4>match_results constructors</h4>
|
||||
|
||||
<p>In all <code>match_results</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>
|
||||
|
||||
<pre>
|
||||
match_results(const Allocator& a = Allocator());
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Constructs an object of class match_results. The
|
||||
postconditions of this function are indicated in the table:</p>
|
||||
|
||||
<p align="center"></p>
|
||||
|
||||
<center>
|
||||
<table id="Table2" cellspacing="1" cellpadding="7" width="624"
|
||||
border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Element</b></p>
|
||||
</td>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Value</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>empty()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>true</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>size()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>0</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>str()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>basic_string<charT>()</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<pre>
|
||||
match_results(const match_results& m);
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Constructs an object of class match_results, as
|
||||
a copy of m.</p>
|
||||
|
||||
<pre>
|
||||
match_results& operator=(const match_results& m);
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Assigns m to *this. The postconditions of this
|
||||
function are indicated in the table:</p>
|
||||
|
||||
<p align="center"></p>
|
||||
|
||||
<center>
|
||||
<table id="Table3" cellspacing="1" cellpadding="7" width="624"
|
||||
border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Element</b></p>
|
||||
</td>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Value</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>empty()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.empty().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>size()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.size().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>str(n)</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.str(n) for all integers n < m.size().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>prefix()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.prefix().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>suffix()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.suffix().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*this)[n]</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m[n] for all integers n < m.size().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>length(n)</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.length(n) for all integers n < m.size().</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>position(n)</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>m.position(n) for all integers n < m.size().</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<h4>match_results size</h4>
|
||||
|
||||
<pre>
|
||||
size_type size()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns the number of sub_match elements stored
|
||||
in *this.</p>
|
||||
|
||||
<pre>
|
||||
size_type max_size()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns the maximum number of sub_match elements
|
||||
that can be stored in *this.</p>
|
||||
|
||||
<pre>
|
||||
bool empty()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns <code>size() == 0</code>.</p>
|
||||
|
||||
<h4>match_results element access</h4>
|
||||
|
||||
<pre>
|
||||
difference_type length(int sub = 0)const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns <code>(*this)[sub].length()</code>.</p>
|
||||
|
||||
<pre>
|
||||
difference_type position(unsigned int sub = 0)const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns <code>std::distance(prefix().first,
|
||||
(*this)[sub].first).</code></p>
|
||||
|
||||
<pre>
|
||||
string_type str(int sub = 0)const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns <code>
|
||||
string_type((*this)[sub]).</code></p>
|
||||
|
||||
<pre>
|
||||
const_reference operator[](int n) const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a reference to the <code>
|
||||
sub_match</code> object representing the character sequence that
|
||||
matched marked sub-expression <i>n</i>. If <code>n == 0</code> then
|
||||
returns a reference to a <code>sub_match</code> object representing
|
||||
the character sequence that matched the whole regular
|
||||
expression.</p>
|
||||
|
||||
<pre>
|
||||
const_reference prefix()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a reference to the <code>
|
||||
sub_match</code> object representing the character sequence from
|
||||
the start of the string being matched/searched, to the start of the
|
||||
match found.</p>
|
||||
|
||||
<pre>
|
||||
const_reference suffix()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a reference to the <code>
|
||||
sub_match</code> object representing the character sequence from
|
||||
the end of the match found to the end of the string being
|
||||
matched/searched.</p>
|
||||
|
||||
<pre>
|
||||
const_iterator begin()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a starting iterator that enumerates over
|
||||
all the marked sub-expression matches stored in *this.</p>
|
||||
|
||||
<pre>
|
||||
const_iterator end()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a terminating iterator that enumerates
|
||||
over all the marked sub-expression matches stored in *this.</p>
|
||||
|
||||
<h4>match_results reformatting</h4>
|
||||
|
||||
<pre>
|
||||
template <class OutputIterator>
|
||||
OutputIterator format(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Requires:</b> The type OutputIterator conforms to the Output
|
||||
Iterator requirements (24.1.2).</p>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Copies the character sequence <i>[fmt.begin(),
|
||||
fmt.end())</i> to OutputIterator <i>out</i>. For each format
|
||||
specifier or escape sequence in <i>fmt</i>, replace that sequence
|
||||
with either the character(s) it represents, or the sequence of
|
||||
characters within *this to which it refers. The bitmasks specified
|
||||
in <i><a href="match_flag_type.html">flags</a></i> determines what
|
||||
<a href="format_syntax.html">format specifiers or escape sequences
|
||||
are recognized</a>, by default this is the format used by ECMA-262,
|
||||
ECMAScript Language Specification, Chapter 15 part 5.4.11
|
||||
String.prototype.replace.</p>
|
||||
|
||||
<b></b>
|
||||
<p><b>Returns:</b> <i>out</i>.</p>
|
||||
|
||||
<pre>
|
||||
string_type format(const string_type& fmt,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a copy of the string <i>fmt</i>. For
|
||||
each format specifier or escape sequence in <i>fmt</i>, replace
|
||||
that sequence with either the character(s) it represents, or the
|
||||
sequence of characters within *this to which it refers. The
|
||||
bitmasks specified in <i><a href="match_flag_type.html">
|
||||
flags</a></i> determines what <a href="format_syntax.html">format
|
||||
specifiers or escape sequences are recognized</a>, by default this
|
||||
is the format used by ECMA-262, ECMAScript Language Specification,
|
||||
Chapter 15 part 5.4.11 String.prototype.replace.</p>
|
||||
|
||||
<pre>
|
||||
allocator_type get_allocator()const;
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Returns a copy of the Allocator that was passed
|
||||
to the object's constructor.</p>
|
||||
|
||||
<pre>
|
||||
void swap(match_results& that);
|
||||
</pre>
|
||||
|
||||
<b></b>
|
||||
<p><b>Effects:</b> Swaps the contents of the two sequences.</p>
|
||||
|
||||
<b></b>
|
||||
<p><b>Postcondition:</b> <code>*this</code> contains the sequence
|
||||
of matched sub-expressions that were in <code>that</code>, <code>
|
||||
that</code> contains the sequence of matched sub-expressions that
|
||||
were in <code>*this</code>.</p>
|
||||
|
||||
<b></b>
|
||||
<p><b>Complexity:</b> constant time.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
185
doc/Attic/partial_matches.html
Normal file
185
doc/Attic/partial_matches.html
Normal file
@ -0,0 +1,185 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Partial Matches</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Partial Matches</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>The <A href="match_flag_type.html">match-flag</A> <CODE>match_partial</CODE> can
|
||||
be passed to the following algorithms: <A href="regex_match.html">regex_match</A>,
|
||||
<A href="regex_search.html">regex_search</A>, and <A href="regex_grep.html">regex_grep</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="match_results.html">match_results<></A> as filled in
|
||||
by regex_match, regex_search or regex_grep):<BR>
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
<TR>
|
||||
<TD vAlign="top" width="20%"> </TD>
|
||||
<TD vAlign="top" width="20%">Result</TD>
|
||||
<TD vAlign="top" width="20%">M[0].matched</TD>
|
||||
<TD vAlign="top" width="20%">M[0].first</TD>
|
||||
<TD vAlign="top" width="20%">M[0].second</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="20%">No match</TD>
|
||||
<TD vAlign="top" width="20%">False</TD>
|
||||
<TD vAlign="top" width="20%">Undefined</TD>
|
||||
<TD vAlign="top" width="20%">Undefined</TD>
|
||||
<TD vAlign="top" width="20%">Undefined</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="20%">Partial match</TD>
|
||||
<TD vAlign="top" width="20%">True</TD>
|
||||
<TD vAlign="top" width="20%">False</TD>
|
||||
<TD vAlign="top" width="20%">Start of partial match.</TD>
|
||||
<TD vAlign="top" width="20%">End of partial match (end of text).</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="20%">Full match</TD>
|
||||
<TD vAlign="top" width="20%">True</TD>
|
||||
<TD vAlign="top" width="20%">True</TD>
|
||||
<TD vAlign="top" width="20%">Start of full match.</TD>
|
||||
<TD vAlign="top" width="20%">End of full match.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>The following <A href="../example/snippets/partial_regex_match.cpp">example</A>
|
||||
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>is_possible_card_number</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>#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
boost::regex e("(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})");
|
||||
|
||||
bool is_possible_card_number(const std::string& input)
|
||||
{
|
||||
//
|
||||
// return false for partial match, true for full match, or throw for
|
||||
// impossible match based on what we have so far...
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
if(0 == boost::regex_match(input, what, e, boost::match_default | boost::match_partial))
|
||||
{
|
||||
// the input so far could not possibly be valid so reject it:
|
||||
throw std::runtime_error("Invalid data entered - this could not possibly be a valid card number");
|
||||
}
|
||||
// OK so far so good, but have we finished?
|
||||
if(what[0].matched)
|
||||
{
|
||||
// excellent, we have a result:
|
||||
return true;
|
||||
}
|
||||
// what we have so far is only a partial match...
|
||||
return false;
|
||||
}</PRE>
|
||||
<P>In the following <A href="../example/snippets/partial_regex_match.cpp">example</A>,
|
||||
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>#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// match some kind of html tag:
|
||||
boost::regex e("<[^>]*>");
|
||||
// count how many:
|
||||
unsigned int tags = 0;
|
||||
// saved position of partial match:
|
||||
char* next_pos = 0;
|
||||
|
||||
bool grep_callback(const boost::match_results<char*>& m)
|
||||
{
|
||||
if(m[0].matched == false)
|
||||
{
|
||||
// save position and return:
|
||||
next_pos = m[0].first;
|
||||
}
|
||||
else
|
||||
++tags;
|
||||
return true;
|
||||
}
|
||||
|
||||
void search(std::istream& is)
|
||||
{
|
||||
char buf[4096];
|
||||
next_pos = buf + sizeof(buf);
|
||||
bool have_more = true;
|
||||
while(have_more)
|
||||
{
|
||||
// how much do we copy forward from last try:
|
||||
unsigned leftover = (buf + sizeof(buf)) - next_pos;
|
||||
// and how much is left to fill:
|
||||
unsigned size = next_pos - buf;
|
||||
// copy forward whatever we have left:
|
||||
memcpy(buf, next_pos, leftover);
|
||||
// fill the rest from the stream:
|
||||
unsigned read = is.readsome(buf + leftover, size);
|
||||
// check to see if we've run out of text:
|
||||
have_more = read == size;
|
||||
// reset next_pos:
|
||||
next_pos = buf + sizeof(buf);
|
||||
// and then grep:
|
||||
boost::regex_grep(grep_callback,
|
||||
buf,
|
||||
buf + read + leftover,
|
||||
e,
|
||||
boost::match_default | boost::match_partial);
|
||||
}
|
||||
}</PRE>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
54
doc/Attic/performance.html
Normal file
54
doc/Attic/performance.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Performance</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Performance</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<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>
|
||||
<P><A href="vc71-performance.html">Visual Studio.Net 2003 (recursive Boost.regex
|
||||
implementation)</A>.</P>
|
||||
<P><A href="gcc-performance.html">Gcc 3.2 (cygwin) (non-recursive Boost.regex
|
||||
implementation).</A></P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
288
doc/Attic/posix_api.html
Normal file
288
doc/Attic/posix_api.html
Normal file
@ -0,0 +1,288 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: POSIX API Compatibility Functions</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">POSIX API Compatibility Functions</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<PRE>#include <boost/cregex.hpp>
|
||||
<I>or</I>:
|
||||
#include <boost/regex.h></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>
|
||||
<P><B>Important</B>: Note that all the symbols defined here are enclosed inside
|
||||
namespace <I>boost</I> when used in C++ programs, unless you use #include
|
||||
<boost/regex.h> instead - in which case the symbols are still defined in
|
||||
namespace boost, but are made available in the global namespace as well.</P>
|
||||
<P>The functions are defined as:
|
||||
</P>
|
||||
<PRE>extern "C" {
|
||||
<B>int</B> regcompA(regex_tA*, <B>const</B> <B>char</B>*, <B>int</B>);
|
||||
<B>unsigned</B> <B>int</B> regerrorA(<B>int</B>, <B>const</B> regex_tA*, <B>char</B>*, <B>unsigned</B> <B>int</B>);
|
||||
<B>int</B> regexecA(<B>const</B> regex_tA*, <B>const</B> <B>char</B>*, <B>unsigned</B> <B>int</B>, regmatch_t*, <B>int</B>);
|
||||
<B>void</B> regfreeA(regex_tA*);
|
||||
|
||||
<B>int</B> regcompW(regex_tW*, <B>const</B> <B>wchar_t</B>*, <B>int</B>);
|
||||
<B>unsigned</B> <B>int</B> regerrorW(<B>int</B>, <B>const</B> regex_tW*, <B>wchar_t</B>*, <B>unsigned</B> <B>int</B>);
|
||||
<B>int</B> regexecW(<B>const</B> regex_tW*, <B>const</B> <B>wchar_t</B>*, <B>unsigned</B> <B>int</B>, regmatch_t*, <B>int</B>);
|
||||
<B>void</B> regfreeW(regex_tW*);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define regcomp regcompW
|
||||
#define regerror regerrorW
|
||||
#define regexec regexecW
|
||||
#define regfree regfreeW
|
||||
#define regex_t regex_tW
|
||||
#else
|
||||
#define regcomp regcompA
|
||||
#define regerror regerrorA
|
||||
#define regexec regexecA
|
||||
#define regfree regfreeA
|
||||
#define regex_t regex_tA
|
||||
#endif
|
||||
}</PRE>
|
||||
<P>All the functions operate on structure <B>regex_t</B>, which exposes two public
|
||||
members:
|
||||
</P>
|
||||
<P><B>unsigned int re_nsub</B> this is filled in by <B>regcomp</B> and indicates
|
||||
the number of sub-expressions contained in the regular expression.
|
||||
</P>
|
||||
<P><B>const TCHAR* re_endp</B> points to the end of the expression to compile when
|
||||
the flag REG_PEND is set.
|
||||
</P>
|
||||
<P><I>Footnote: regex_t is actually a #define - it is either regex_tA or regex_tW
|
||||
depending upon whether UNICODE is defined or not, TCHAR is either char or
|
||||
wchar_t again depending upon the macro UNICODE.</I>
|
||||
</P>
|
||||
<H3>regcomp</H3>
|
||||
<P><B>regcomp</B> takes a pointer to a <B>regex_t</B>, a pointer to the expression
|
||||
to compile and a flags parameter which can be a combination of:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_EXTENDED</TD>
|
||||
<TD vAlign="top" width="45%">Compiles modern regular expressions. Equivalent to
|
||||
regbase::char_classes | regbase::intervals | regbase::bk_refs.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_BASIC</TD>
|
||||
<TD vAlign="top" width="45%">Compiles basic (obsolete) regular expression syntax.
|
||||
Equivalent to regbase::char_classes | regbase::intervals | regbase::limited_ops
|
||||
| regbase::bk_braces | regbase::bk_parens | regbase::bk_refs.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_NOSPEC</TD>
|
||||
<TD vAlign="top" width="45%">All characters are ordinary, the expression is a
|
||||
literal string.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_ICASE</TD>
|
||||
<TD vAlign="top" width="45%">Compiles for matching that ignores character case.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_NOSUB</TD>
|
||||
<TD vAlign="top" width="45%">Has no effect in this library.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_NEWLINE</TD>
|
||||
<TD vAlign="top" width="45%">When this flag is set a dot does not match the
|
||||
newline character.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_PEND</TD>
|
||||
<TD vAlign="top" width="45%">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.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_NOCOLLATE</TD>
|
||||
<TD vAlign="top" width="45%">When this flag is set then locale dependent collation
|
||||
for character ranges is turned off.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_ESCAPE_IN_LISTS<BR>
|
||||
, , ,
|
||||
</TD>
|
||||
<TD vAlign="top" width="45%">When this flag is set, then escape sequences are
|
||||
permitted in bracket expressions (character sets).</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_NEWLINE_ALT </TD>
|
||||
<TD vAlign="top" width="45%">When this flag is set then the newline character is
|
||||
equivalent to the alternation operator |.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_PERL </TD>
|
||||
<TD vAlign="top" width="45%">Compiles Perl like regular expressions.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_AWK</TD>
|
||||
<TD vAlign="top" width="45%">A shortcut for awk-like behavior: REG_EXTENDED |
|
||||
REG_ESCAPE_IN_LISTS</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_GREP</TD>
|
||||
<TD vAlign="top" width="45%">A shortcut for grep like behavior: REG_BASIC |
|
||||
REG_NEWLINE_ALT</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_EGREP</TD>
|
||||
<TD vAlign="top" width="45%"> A shortcut for egrep like behavior:
|
||||
REG_EXTENDED | REG_NEWLINE_ALT</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3>regerror</H3>
|
||||
<P>regerror takes the following parameters, it maps an error code to a human
|
||||
readable string:
|
||||
<BR>
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="50%">int code</TD>
|
||||
<TD vAlign="top" width="50%">The error code.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> </TD>
|
||||
<TD vAlign="top" width="50%">const regex_t* e</TD>
|
||||
<TD vAlign="top" width="50%">The regular expression (can be null).</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> </TD>
|
||||
<TD vAlign="top" width="50%">char* buf</TD>
|
||||
<TD vAlign="top" width="50%">The buffer to fill in with the error message.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> </TD>
|
||||
<TD vAlign="top" width="50%">unsigned int buf_size</TD>
|
||||
<TD vAlign="top" width="50%">The length of buf.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<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 <B>e</B> must not be null and <B>e->re_pend</B> 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 <B>code</B>, the return value
|
||||
is the number of characters in the error message, if the return value is
|
||||
greater than or equal to <B>buf_size</B> then <B>regerror</B> will have to be
|
||||
called again with a larger buffer.</P>
|
||||
<H3>regexec</H3>
|
||||
<P><B>regexec</B> finds the first occurrence of expression <B>e</B> within string <B>buf</B>.
|
||||
If <B>len</B> is non-zero then *<B>m</B> is filled in with what matched the
|
||||
regular expression, <B>m[0]</B> contains what matched the whole string, <B>m[1] </B>
|
||||
the first sub-expression etc, see <B>regmatch_t</B> in the header file
|
||||
declaration for more details. The <B>eflags</B> parameter can be a combination
|
||||
of:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table4" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="50%">REG_NOTBOL</TD>
|
||||
<TD vAlign="top" width="50%">Parameter <B>buf </B>does not represent the start of
|
||||
a line.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> </TD>
|
||||
<TD vAlign="top" width="50%">REG_NOTEOL</TD>
|
||||
<TD vAlign="top" width="50%">Parameter <B>buf</B> does not terminate at the end of
|
||||
a line.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> </TD>
|
||||
<TD vAlign="top" width="50%">REG_STARTEND</TD>
|
||||
<TD vAlign="top" width="50%">The string searched starts at buf + pmatch[0].rm_so
|
||||
and ends at buf + pmatch[0].rm_eo.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3>regfree</H3>
|
||||
<P>Finally <B>regfree</B> frees all the memory that was allocated by regcomp.
|
||||
</P>
|
||||
<P><I>Footnote: this is an abridged reference to the POSIX API functions, it is
|
||||
provided for compatibility with other libraries, rather than 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.</I>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
84
doc/Attic/redistributables.html
Normal file
84
doc/Attic/redistributables.html
Normal file
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Redistributables and Library Names</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Redistributables and Library Names</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>If you are using Microsoft or Borland C++ and link to a dll version of the run
|
||||
time library, then you will also link to one of the dll versions of boost.regex.
|
||||
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 following
|
||||
formula:<BR>
|
||||
</P>
|
||||
<P></P>
|
||||
<P>"boost_regex_"<BR>
|
||||
+ BOOST_LIB_TOOLSET<BR>
|
||||
+ "_"<BR>
|
||||
+ BOOST_LIB_THREAD_OPT<BR>
|
||||
+ BOOST_LIB_RT_OPT<BR>
|
||||
+ BOOST_LIB_LINK_OPT<BR>
|
||||
+ BOOST_LIB_DEBUG_OPT<BR>
|
||||
<BR>
|
||||
These are defined as:<BR>
|
||||
<BR>
|
||||
BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).<BR>
|
||||
<BR>
|
||||
BOOST_LIB_THREAD_OPT: "s" for single thread builds,<BR>
|
||||
"m" for multithread builds.<BR>
|
||||
<BR>
|
||||
BOOST_LIB_RT_OPT: "s" for static runtime,<BR>
|
||||
"d" for dynamic runtime.<BR>
|
||||
<BR>
|
||||
BOOST_LIB_LINK_OPT: "s" for static link,<BR>
|
||||
"i" for dynamic link.<BR>
|
||||
<BR>
|
||||
BOOST_LIB_DEBUG_OPT: nothing for release builds,<BR>
|
||||
"d" for debug builds,<BR>
|
||||
"dd" for debug-diagnostic builds (_STLP_DEBUG).</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 statically
|
||||
link even though you're using the dll version of your run time library, or if
|
||||
you need to debug boost.regex.
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
46
doc/Attic/reg_expression.html
Normal file
46
doc/Attic/reg_expression.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Class reg_expression (deprecated)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Class reg_expression (deprecated)</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>The use of class template reg_expression is deprecated: use <A href="basic_regex.html">
|
||||
basic_regex</A> instead.</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
91
doc/Attic/regbase.html
Normal file
91
doc/Attic/regbase.html
Normal file
@ -0,0 +1,91 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: regbase</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">regbase</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>Use of the type <code>boost::regbase</code> is now deprecated,
|
||||
and the type does not form a part of the <a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">
|
||||
regular expression standardization proposal</a>. This type
|
||||
still exists as a base class of <code>boost::basic_regex</code>,
|
||||
and you can still refer to <code>
|
||||
boost::regbase::constant_name</code> in your code, however for
|
||||
maximum portability to other std regex implementations you should
|
||||
instead use either:</p>
|
||||
|
||||
<pre>
|
||||
boost::regex_constants::constant_name
|
||||
</pre>
|
||||
|
||||
<p>or</p>
|
||||
|
||||
<pre>
|
||||
boost::regex::constant_name
|
||||
</pre>
|
||||
|
||||
<p>or</p>
|
||||
|
||||
<pre>
|
||||
boost::wregex::constant_name
|
||||
</pre>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
620
doc/Attic/regex.html
Normal file
620
doc/Attic/regex.html
Normal file
@ -0,0 +1,620 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: class RegEx (deprecated)</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">class RegEx (deprecated)</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>The high level wrapper class RegEx is now deprecated and does
|
||||
not form a part of the <a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">
|
||||
regular expression standardization proposal</a>. This type
|
||||
still exists, and existing code will continue to compile, however
|
||||
the following documentation is unlikely to be further updated.</p>
|
||||
|
||||
<pre>
|
||||
#include <boost/cregex.hpp>
|
||||
</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>
|
||||
<b>typedef</b> <b>bool</b> (*GrepCallback)(<b>const</b> RegEx& expression);
|
||||
<b>typedef</b> <b>bool</b> (*GrepFileCallback)(<b>const</b> <b>char</b>* file, <b>const</b> RegEx& expression);
|
||||
<b>typedef</b> <b>bool</b> (*FindFilesCallback)(<b>const</b> <b>char</b>* file);
|
||||
|
||||
<b>class</b> RegEx
|
||||
{
|
||||
<b>public</b>:
|
||||
RegEx();
|
||||
RegEx(<b>const</b> RegEx& o);
|
||||
~RegEx();
|
||||
RegEx(<b>const</b> <b>char</b>* c, <b>bool</b> icase = <b>false</b>);
|
||||
<strong>explicit</strong> RegEx(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
|
||||
RegEx& <b>operator</b>=(<b>const</b> RegEx& o);
|
||||
RegEx& <b>operator</b>=(<b>const</b> <b>char</b>* p);
|
||||
RegEx& <b>operator</b>=(<b>const</b> std::string& s);
|
||||
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> <b>char</b>* p, <b>bool</b> icase = <b>false</b>);
|
||||
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
|
||||
std::string Expression()<b>const</b>;
|
||||
<font color="#000080"><i>//
|
||||
</i> <i>// now matching operators:</i>
|
||||
<i>//</i></font>
|
||||
<b>bool</b> Match(<b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Match(<b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Search(<b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Search(<b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
std::string Merge(<b>const</b> std::string& in, <b>const</b> std::string& fmt, <b>bool</b> copy = <b>true</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
std::string Merge(<b>const</b> char* in, <b>const</b> char* fmt, <b>bool</b> copy = <b>true</b>, <b>unsigned int</b> flags = match_default);
|
||||
<b>unsigned</b> Split(std::vector<std::string>& v, std::string& s, <b>unsigned</b> flags = match_default, <b>unsigned</b> max_count = ~0);
|
||||
<font color="#000080"><i>//
|
||||
</i> <i>// now operators for returning what matched in more detail:
|
||||
</i> <i>//
|
||||
</i></font> <b>unsigned</b> <b>int</b> Position(<b>int</b> i = 0)<b>const</b>;
|
||||
<b>unsigned</b> <b>int</b> Length(<b>int</b> i = 0)<b>const</b>;
|
||||
<strong>bool</strong> Matched(<strong>int</strong> i = 0)<strong>const</strong>;
|
||||
<b>unsigned</b> <b>int</b> Line()<b>const</b>;
|
||||
<b>unsigned int</b> Marks() const;
|
||||
std::string What(<b>int</b> i)<b>const</b>;
|
||||
std::string <b>operator</b>[](<b>int</b> i)<b>const</b> ;
|
||||
|
||||
<strong>static const unsigned int</strong> npos;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<p>Member functions for class RegEx are defined as follows:<br>
|
||||
</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="0" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx();</td>
|
||||
<td valign="top" width="42%">Default constructor, constructs an
|
||||
instance of RegEx without any valid expression.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> RegEx& o);</td>
|
||||
<td valign="top" width="42%">Copy constructor, all the properties
|
||||
of parameter <i>o</i> are copied.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> <b>char</b>* c, <b>
|
||||
bool</b> icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Constructs an instance of RegEx,
|
||||
setting the expression to <i>c</i>, if <i>icase</i> is <i>true</i>
|
||||
then matching is insensitive to case, otherwise it is sensitive to
|
||||
case. Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> std::string& s,
|
||||
<b>bool</b> icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Constructs an instance of RegEx,
|
||||
setting the expression to <i>s</i>, if <i>icase</i> is <i>true</i>
|
||||
then matching is insensitive to case, otherwise it is sensitive to
|
||||
case. Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>
|
||||
operator</b>=(<b>const</b> RegEx& o);</td>
|
||||
<td valign="top" width="42%">Default assignment operator.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>
|
||||
operator</b>=(<b>const</b> <b>char</b>* p);</td>
|
||||
<td valign="top" width="42%">Assignment operator, equivalent to
|
||||
calling <i>SetExpression(p, false).</i> Throws <i>
|
||||
bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>
|
||||
operator</b>=(<b>const</b> std::string& s);</td>
|
||||
<td valign="top" width="42%">Assignment operator, equivalent to
|
||||
calling <i>SetExpression(s, false).</i> Throws <i>
|
||||
bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
SetExpression(<b>constchar</b>* p, <b>bool</b> icase = <b>
|
||||
false</b>);</td>
|
||||
<td valign="top" width="42%">Sets the current expression to <i>
|
||||
p</i>, if <i>icase</i> is <i>true</i> then matching is insensitive
|
||||
to case, otherwise it is sensitive to case. Throws <i>
|
||||
bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
SetExpression(<b>const</b> std::string& s, <b>bool</b> icase =
|
||||
<b>false</b>);</td>
|
||||
<td valign="top" width="42%">Sets the current expression to <i>
|
||||
s</i>, if <i>icase</i> is <i>true</i> then matching is insensitive
|
||||
to case, otherwise it is sensitive to case. Throws <i>
|
||||
bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string
|
||||
Expression()<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns a copy of the current regular
|
||||
expression.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b> <b>
|
||||
char</b>* p, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Attempts to match the current
|
||||
expression against the text <i>p</i> using the match flags <i>
|
||||
flags</i> - see <a href="match_flag_type.html">match flags</a>.
|
||||
Returns <i>true</i> if the expression matches the whole of the
|
||||
input string.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default) ;</td>
|
||||
<td valign="top" width="42%">Attempts to match the current
|
||||
expression against the text <i>s</i> using the match flags <i>
|
||||
flags</i> - see <a href="match_flag_type.html">match flags</a>.
|
||||
Returns <i>true</i> if the expression matches the whole of the
|
||||
input string.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b> <b>
|
||||
char</b>* p, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Attempts to find a match for the
|
||||
current expression somewhere in the text <i>p</i> using the match
|
||||
flags <i>flags</i> - see <a href="match_flag_type.html">match
|
||||
flags</a>. Returns <i>true</i> if the match succeeds.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default) ;</td>
|
||||
<td valign="top" width="42%">Attempts to find a match for the
|
||||
current expression somewhere in the text <i>s</i> using the match
|
||||
flags <i>flags</i> - see <a href="match_flag_type.html">match
|
||||
flags</a>. Returns <i>true</i> if the match succeeds.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(GrepCallback cb, <b>const</b> <b>char</b>* p, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>p</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match found calls the call-back function <i>cb</i> as: cb(*this);
|
||||
|
||||
<p>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>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(GrepCallback cb, <b>const</b> std::string& s, <b>
|
||||
unsigned</b> <b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>s</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match found calls the call-back function <i>cb</i> as: cb(*this);
|
||||
|
||||
<p>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>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<std::string>& v, <b>const</b> <b>
|
||||
char</b>* p, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>p</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match pushes a copy of what matched onto <i>v</i>. Returns the
|
||||
number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<std::string>& v, <b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>s</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match pushes a copy of what matched onto <i>v</i>. Returns the
|
||||
number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<<b>unsigned int</b>>& v, <b>const</b>
|
||||
<b>char</b>* p, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>p</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match pushes the starting index of what matched onto <i>v</i>.
|
||||
Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<<b>unsigned int</b>>& v, <b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the text <i>s</i> using the match flags <i>flags</i>
|
||||
- see <a href="match_flag_type.html">match flags</a>. For each
|
||||
match pushes the starting index of what matched onto <i>v</i>.
|
||||
Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
GrepFiles(GrepFileCallback cb, <b>const</b> <b>char</b>* files, <b>
|
||||
bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the files <i>files</i> using the match flags <i>
|
||||
flags</i> - see <a href="match_flag_type.html">match flags</a>. For
|
||||
each match calls the call-back function cb.
|
||||
|
||||
<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 <i>files</i> can include wild card characters '*'
|
||||
and '?', if the parameter <i>recurse</i> 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 std::runtime_error if file
|
||||
io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
GrepFiles(GrepFileCallback cb, <b>const</b> std::string& files,
|
||||
<b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b>
|
||||
flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the current
|
||||
expression in the files <i>files</i> using the match flags <i>
|
||||
flags</i> - see <a href="match_flag_type.html">match flags</a>. For
|
||||
each match calls the call-back function cb.
|
||||
|
||||
<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 <i>files</i> can include wild card characters '*'
|
||||
and '?', if the parameter <i>recurse</i> 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 std::runtime_error if file
|
||||
io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
FindFiles(FindFilesCallback cb, <b>const</b> <b>char</b>* files,
|
||||
<b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b>
|
||||
flags = match_default);</td>
|
||||
<td valign="top" width="42%">Searches <i>files</i> to find all
|
||||
those which contain at least one match of the current expression
|
||||
using the match flags <i>flags</i> - see <a href="match_flag_type.html">match flags</a>. For each matching file
|
||||
calls the call-back function cb.
|
||||
|
||||
<p>If the call-back returns false then the algorithm returns
|
||||
without considering any further files. </p>
|
||||
|
||||
<p>The parameter <i>files</i> can include wild card characters '*'
|
||||
and '?', if the parameter <i>recurse</i> 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 std::runtime_error if file
|
||||
io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
FindFiles(FindFilesCallback cb, <b>const</b> std::string&
|
||||
files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>
|
||||
int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Searches <i>files</i> to find all
|
||||
those which contain at least one match of the current expression
|
||||
using the match flags <i>flags</i> - see <a href="match_flag_type.html">match flags</a>. For each matching file
|
||||
calls the call-back function cb.
|
||||
|
||||
<p>If the call-back returns false then the algorithm returns
|
||||
without considering any further files. </p>
|
||||
|
||||
<p>The parameter <i>files</i> can include wild card characters '*'
|
||||
and '?', if the parameter <i>recurse</i> 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 std::runtime_error if file
|
||||
io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string Merge(<b>const</b>
|
||||
std::string& in, <b>const</b> std::string& fmt, <b>bool</b>
|
||||
copy = <b>true</b>, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Performs a search and replace
|
||||
operation: searches through the string <i>in</i> for all
|
||||
occurrences of the current expression, for each occurrence replaces
|
||||
the match with the format string <i>fmt</i>. Uses <i>flags</i> to
|
||||
determine what gets matched, and how the format string should be
|
||||
treated. If <i>copy</i> is true then all unmatched sections of
|
||||
input are copied unchanged to output, if the flag <em>
|
||||
format_first_only</em> is set then only the first occurance of the
|
||||
pattern found is replaced. Returns the new string. See <a href="format_synatx.html">also format string syntax</a>, <a href="match_flag_type.html">match flags</a> and <a href="match_flag_type.html">format flags</a>.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string Merge(<b>const</b> char*
|
||||
in, <b>const</b> char* fmt, <b>bool</b> copy = <b>true</b>, <b>
|
||||
unsigned int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Performs a search and replace
|
||||
operation: searches through the string <i>in</i> for all
|
||||
occurrences of the current expression, for each occurrence replaces
|
||||
the match with the format string <i>fmt</i>. Uses <i>flags</i> to
|
||||
determine what gets matched, and how the format string should be
|
||||
treated. If <i>copy</i> is true then all unmatched sections of
|
||||
input are copied unchanged to output, if the flag <em>
|
||||
format_first_only</em> is set then only the first occurance of the
|
||||
pattern found is replaced. Returns the new string. See <a href="format_synatx.html">also format string syntax</a>, <a href="match_flag_type.html">match flags</a> and <a href="match_flag_type.html">format flags</a>.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top"><b>unsigned</b>
|
||||
Split(std::vector<std::string>& v, std::string& s,
|
||||
<b>unsigned</b> flags = match_default, <b>unsigned</b> max_count =
|
||||
~0);</td>
|
||||
<td valign="top">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 <i>
|
||||
max_count</i> strings. Before returning, deletes from the input
|
||||
string <i>s</i> all of the input that has been processed (all of
|
||||
the string if <i>max_count</i> was not reached). Returns the number
|
||||
of strings pushed onto the vector.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Position(<b>int</b> i = 0)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the position of what matched
|
||||
sub-expression <i>i</i>. If <i>i = 0</i> then returns the position
|
||||
of the whole match. Returns RegEx::npos if the supplied index is
|
||||
invalid, or if the specified sub-expression did not participate in
|
||||
the match.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Length(<b>int</b> i = 0)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the length of what matched
|
||||
sub-expression <i>i</i>. If <i>i = 0</i> then returns the length of
|
||||
the whole match. Returns RegEx::npos if the supplied index is
|
||||
invalid, or if the specified sub-expression did not participate in
|
||||
the match.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><strong>bool</strong> Matched(<strong>int</strong> i =
|
||||
0)<strong>const</strong>;</td>
|
||||
<td>Returns true if sub-expression <em>i</em> was matched, false
|
||||
otherwise.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Line()<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the line on which the match
|
||||
occurred, indexes start from 1 not zero, if no match occurred then
|
||||
returns RegEx::npos.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned int</b> Marks()
|
||||
const;</td>
|
||||
<td valign="top" width="42%">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.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string What(<b>int</b>
|
||||
i)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns a copy of what matched
|
||||
sub-expression <i>i</i>. If <i>i = 0</i> 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.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string <b>
|
||||
operator</b>[](<b>int</b> i)<b>const</b> ;</td>
|
||||
<td valign="top" width="42%">Returns <i>what(i);</i>
|
||||
|
||||
<p>Can be used to simplify access to sub-expression matches, and
|
||||
make usage more perl-like.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
213
doc/Attic/regex_format.html
Normal file
213
doc/Attic/regex_format.html
Normal file
@ -0,0 +1,213 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<title>Boost.Regex: Algorithm regex_format (deprecated)</title>
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Algorithm regex_format (deprecated)</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>The algorithm regex_format is deprecated; new code should use
|
||||
match_results::format 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>
|
||||
|
||||
<h3>Algorithm regex_format</h3>
|
||||
|
||||
<pre>
|
||||
#include <<a href="../../boost/regex.hpp">boost/regex.hpp</a>>
|
||||
</pre>
|
||||
|
||||
<p>The algorithm regex_format takes the results of a match and
|
||||
creates a new string based upon a <a href="format_syntax.html">
|
||||
format string</a>, regex_format can be used for search and replace
|
||||
operations:</p>
|
||||
|
||||
<pre>
|
||||
<b>template</b> <<b>class</b> OutputIterator, <b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
<b>const</b> match_results<iterator, Allocator>& m,
|
||||
<b>const</b> charT* fmt,
|
||||
match_flag_type flags = 0);
|
||||
<b>template</b> <<b>class</b> OutputIterator, <b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
<b>const</b> match_results<iterator, Allocator>& m,
|
||||
<b>const</b> std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = 0);
|
||||
</pre>
|
||||
|
||||
<p>The library also defines the following convenience variation of
|
||||
regex_format, which returns the result directly as a string, rather
|
||||
than outputting to an iterator [note - this version may not be
|
||||
available, or may be available in a more limited form, depending
|
||||
upon your compilers capabilities]:</p>
|
||||
|
||||
<pre>
|
||||
<b>template</b> <<b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT>
|
||||
std::basic_string<charT> regex_format
|
||||
(<b>const</b> match_results<iterator, Allocator>& m,
|
||||
<b>const</b> charT* fmt,
|
||||
match_flag_type flags = 0);
|
||||
|
||||
<b>template</b> <<b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT>
|
||||
std::basic_string<charT> regex_format
|
||||
(<b>const</b> match_results<iterator, Allocator>& m,
|
||||
<b>const</b> std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = 0);
|
||||
</pre>
|
||||
|
||||
<p>Parameters to the main version of the function are passed as
|
||||
follows:</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="0" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%">OutputIterator out</td>
|
||||
<td valign="top" width="44%">An output iterator type, the output
|
||||
string is sent to this iterator. Typically this would be a
|
||||
std::ostream_iterator.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%"><b>const</b>
|
||||
match_results<iterator, Allocator>& m</td>
|
||||
<td valign="top" width="44%">An instance of match_results<>
|
||||
obtained from one of the matching algorithms above, and denoting
|
||||
what matched.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%"><b>const</b> charT* fmt</td>
|
||||
<td valign="top" width="44%">A format string that determines how
|
||||
the match is transformed into the new string.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%"><b>unsigned</b> flags</td>
|
||||
<td valign="top" width="44%">Optional flags which describe how the
|
||||
format string is to be interpreted.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p><a name="format_flags"></a>Format flags are defined as
|
||||
follows:</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table3" cellspacing="0" cellpadding="7" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%">format_all</td>
|
||||
<td valign="top" width="43%">Enables all syntax options (perl-like
|
||||
plus extentions).</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%">format_sed</td>
|
||||
<td valign="top" width="43%">Allows only a sed-like syntax.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%">format_perl</td>
|
||||
<td valign="top" width="43%">Allows only a perl-like syntax.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" width="9%"> </td>
|
||||
<td valign="top" width="39%">format_no_copy</td>
|
||||
<td valign="top" width="43%">Disables copying of unmatched sections
|
||||
to the output string during <a href="regex_merge.html">
|
||||
regex_merge</a> operations.</td>
|
||||
<td valign="top" width="9%"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>format_first_only</td>
|
||||
<td>When this flag is set only the first occurance will be replaced
|
||||
(applies to regex_merge only).</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>The format string syntax (and available options) is described
|
||||
more fully under <a href="format_syntax.html">format strings</a>
|
||||
.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
|
||||
<p><i>© Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
|
||||
Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and
|
||||
sell this software and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice
|
||||
appear in all copies and that both that copyright notice and this
|
||||
permission notice appear in supporting documentation. Dr John
|
||||
Maddock makes no representations about the suitability of this
|
||||
software for any purpose. It is provided "as is" without express or
|
||||
implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
386
doc/Attic/regex_grep.html
Normal file
386
doc/Attic/regex_grep.html
Normal file
@ -0,0 +1,386 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_grep (deprecated)</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">Algorithm regex_grep (deprecated)</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<p>The algorithm regex_grep is deprecated in favor of <a href="regex_iterator.html">regex_iterator</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>
|
||||
<hr>
|
||||
<pre>
|
||||
#include <<a href="../../boost/regex.hpp">boost/regex.hpp</a>>
|
||||
</pre>
|
||||
<p>regex_grep 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>
|
||||
<b>template</b> <<b>class</b> Predicate, <b>class</b> iterator, <b>class</b> charT, <b>class</b> traits, <b>class</b> Allocator>
|
||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||
iterator first,
|
||||
iterator last,
|
||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||
<b>unsigned</b> flags = match_default)
|
||||
</pre>
|
||||
<p>The library also defines the following convenience versions, which take either
|
||||
a const charT*, or a const std::basic_string<>& in place of a pair of
|
||||
iterators [note - these versions may not be available, or may be available in a
|
||||
more limited form, depending upon your compilers capabilities]:</p>
|
||||
<pre>
|
||||
<b>template</b> <<b>class</b> Predicate, <b>class</b> charT, <b>class</b> Allocator, <b>class</b> traits>
|
||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||
<b>const</b> charT* str,
|
||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||
<b>unsigned</b> flags = match_default);
|
||||
|
||||
<b>template</b> <<b>class</b> Predicate, <b>class</b> ST, <b>class</b> SA, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits>
|
||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||
<b>const</b> std::basic_string<charT, ST, SA>& s,
|
||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||
<b>unsigned</b> flags = match_default);
|
||||
</pre>
|
||||
<p>The parameters for the primary version of regex_grep have the following
|
||||
meanings: </p>
|
||||
<p></p>
|
||||
<table id="Table2" cellspacing="0" cellpadding="7" width="624" border="0">
|
||||
<tr>
|
||||
<td width="5%"> </td>
|
||||
<td valign="top" width="50%">foo</td>
|
||||
<td valign="top" width="50%">A predicate function object or function pointer, see
|
||||
below for more information.</td>
|
||||
<td width="5%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top" width="50%">first</td>
|
||||
<td valign="top" width="50%">The start of the range to search.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top" width="50%">last</td>
|
||||
<td valign="top" width="50%">The end of the range to search.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top" width="50%">e</td>
|
||||
<td valign="top" width="50%">The regular expression to search for.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top" width="50%">flags</td>
|
||||
<td valign="top" width="50%">The flags that determine how matching is carried out,
|
||||
one of the <a href="#match_type">match_flags</a> enumerators.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<p>The algorithm finds all of the non-overlapping matches of the expression e, for
|
||||
each match it fills a <a href="#reg_match">match_results</a><iterator,
|
||||
Allocator> structure, which contains information on what matched, and calls
|
||||
the predicate foo, passing the match_results<iterator, Allocator> as a
|
||||
single argument. If the predicate returns true, 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>
|
||||
<b>struct</b> grep_predicate
|
||||
{
|
||||
<b> bool</b> <b>operator</b>()(<b>const</b> match_results<iterator_type, typename expression_type::alloc_type::template rebind<sub_match<BidirectionalIterator> >::other>& m);
|
||||
};
|
||||
</pre>
|
||||
<p>Note that in almost every case the allocator parameter can be omitted, when
|
||||
specifying the <a href="match_results.html">match_results</a> type,
|
||||
alternatively one of the typedefs cmatch, wcmatch, smatch or wsmatch can be
|
||||
used.</p>
|
||||
<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 regex_grep can
|
||||
even be chained into another regex_grep to create recursive parsers.</p>
|
||||
<P>The algorithm may throw <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<p><a href="../example/snippets/regex_grep_example_1.cpp"> Example</a>: convert
|
||||
the example from <i>regex_search</i> to use <i>regex_grep</i> instead:</p>
|
||||
<pre>
|
||||
<font color="#008000">#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
</font><font color="#000080"><i>// IndexClasses:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
</i></font><b>typedef</b> std::map<std::string, <b>int</b>, std::less<std::string> > map_type;
|
||||
|
||||
const char* re =
|
||||
// possibly leading whitespace:
|
||||
"^[[:space:]]*"
|
||||
// possible template declaration:
|
||||
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
// class or struct:
|
||||
"(class|struct)[[:space:]]*"
|
||||
// leading declspec macros etc:
|
||||
"("
|
||||
"\\<\\w+\\>"
|
||||
"("
|
||||
"[[:blank:]]*\\([^)]*\\)"
|
||||
")?"
|
||||
"[[:space:]]*"
|
||||
")*"
|
||||
// the class name
|
||||
"(\\<\\w*\\>)[[:space:]]*"
|
||||
// template specialisation parameters
|
||||
"(<[^;:{]+>)?[[:space:]]*"
|
||||
// terminate in { or :
|
||||
"(\\{|:[^;\\{()]*\\{)";
|
||||
|
||||
boost::regex expression(re);
|
||||
<b>class</b> IndexClassesPred
|
||||
{
|
||||
map_type& m;
|
||||
std::string::const_iterator base;
|
||||
<b>public</b>:
|
||||
IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {}
|
||||
<b>bool</b> <b>operator</b>()(<b>const</b> smatch& what)
|
||||
{
|
||||
<font color=
|
||||
#000080> <i>// what[0] contains the whole string
|
||||
</i> <i>// what[5] contains the class name.
|
||||
</i> <i>// what[6] contains the template specialisation if any.
|
||||
</i> <i>// add class name and position to map:
|
||||
</i></font> m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
<b>return</b> <b>true</b>;
|
||||
}
|
||||
};
|
||||
<b>void</b> IndexClasses(map_type& m, <b>const</b> std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
regex_grep(IndexClassesPred(m, start), start, end, expression);
|
||||
}
|
||||
</pre>
|
||||
<p><a href="../example/snippets/regex_grep_example_2.cpp"> Example</a>: Use
|
||||
regex_grep to call a global callback function:</p>
|
||||
<pre>
|
||||
<font color="#008000">#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
</font><font color="#000080"><i>// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
</i></font><b>typedef</b> std::map<std::string, <b>int</b>, std::less<std::string> > map_type;
|
||||
|
||||
const char* re =
|
||||
// possibly leading whitespace:
|
||||
"^[[:space:]]*"
|
||||
// possible template declaration:
|
||||
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
// class or struct:
|
||||
"(class|struct)[[:space:]]*"
|
||||
// leading declspec macros etc:
|
||||
"("
|
||||
"\\<\\w+\\>"
|
||||
"("
|
||||
"[[:blank:]]*\\([^)]*\\)"
|
||||
")?"
|
||||
"[[:space:]]*"
|
||||
")*"
|
||||
// the class name
|
||||
"(\\<\\w*\\>)[[:space:]]*"
|
||||
// template specialisation parameters
|
||||
"(<[^;:{]+>)?[[:space:]]*"
|
||||
// terminate in { or :
|
||||
"(\\{|:[^;\\{()]*\\{)";
|
||||
|
||||
boost::regex expression(re);
|
||||
map_type class_index;
|
||||
std::string::const_iterator base;
|
||||
|
||||
<b>bool</b> grep_callback(<b>const</b> boost::smatch& what)
|
||||
{
|
||||
<font color="#000080"> <i>// what[0] contains the whole string
|
||||
</i> <i>// what[5] contains the class name.
|
||||
</i> <i>// what[6] contains the template specialisation if any.
|
||||
</i> <i>// add class name and position to map:
|
||||
</i></font> class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
<b>return</b> <b>true</b>;
|
||||
}
|
||||
<b>void</b> IndexClasses(<b>const</b> std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
regex_grep(grep_callback, start, end, expression, match_default);
|
||||
}
|
||||
|
||||
</pre>
|
||||
<p><a href="../example/snippets/regex_grep_example_3.cpp"> Example</a>: use
|
||||
regex_grep to call a class member function, use the standard library adapters <i>std::mem_fun</i>
|
||||
and <i>std::bind1st</i> to convert the member function into a predicate:</p>
|
||||
<pre>
|
||||
<font color="#008000">#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
#include <functional>
|
||||
</font><font color="#000080"><i>// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
</i></font><b>typedef</b> std::map<std::string, <b>int</b>, std::less<std::string> > map_type;
|
||||
<b>class</b> class_index
|
||||
{
|
||||
boost::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
<b>bool</b> grep_callback(boost::smatch what);
|
||||
<b>public</b>:
|
||||
<b> void</b> IndexClasses(<b>const</b> std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression(<font color=
|
||||
#000080>"^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"
|
||||
"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"
|
||||
"(\\{|:[^;\\{()]*\\{)"
|
||||
</font> ){}
|
||||
};
|
||||
<b>bool</b> class_index::grep_callback(boost::smatch what)
|
||||
{
|
||||
<font color="#000080"> <i>// what[0] contains the whole string
|
||||
</i> <i>// what[5] contains the class name.
|
||||
</i> <i>// what[6] contains the template specialisation if any.
|
||||
</i> <i>// add class name and position to map:
|
||||
</i></font> index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
<b>return</b> <b>true</b>;
|
||||
}
|
||||
|
||||
<b>void</b> class_index::IndexClasses(<b>const</b> std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
regex_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), <b>this</b>),
|
||||
start,
|
||||
end,
|
||||
expression);
|
||||
}
|
||||
|
||||
</pre>
|
||||
<p><a href="../example/snippets/regex_grep_example_4.cpp"> Finally</a>, C++
|
||||
Builder users can use C++ Builder's closure type as a callback argument:</p>
|
||||
<pre>
|
||||
<font color="#008000">#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
#include <functional>
|
||||
</font><font color="#000080"><i>// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
</i></font><b>typedef</b> std::map<std::string, <b>int</b>, std::less<std::string> > map_type;
|
||||
<b>class</b> class_index
|
||||
{
|
||||
boost::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
<b>typedef</b> boost::smatch arg_type;
|
||||
<b>bool</b> grep_callback(<b>const</b> arg_type& what);
|
||||
<b>public</b>:
|
||||
<b>typedef</b> <b>bool</b> (<b>__closure</b>* grep_callback_type)(<b>const</b> arg_type&);
|
||||
<b>void</b> IndexClasses(<b>const</b> std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression(<font color=
|
||||
#000080>"^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"
|
||||
"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"
|
||||
"(\\{|:[^;\\{()]*\\{)"
|
||||
</font> ){}
|
||||
};
|
||||
|
||||
<b>bool</b> class_index::grep_callback(<b>const</b> arg_type& what)
|
||||
{
|
||||
<font color=
|
||||
#000080> <i>// what[0] contains the whole string</i>
|
||||
<i>// what[5] contains the class name.</i>
|
||||
<i>// what[6] contains the template specialisation if any.</i>
|
||||
<i>// add class name and position to map:</i></font>
|
||||
index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
<b>return</b> <b>true</b>;
|
||||
}
|
||||
|
||||
<b>void</b> class_index::IndexClasses(<b>const</b> std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
class_index::grep_callback_type cl = &(<b>this</b>->grep_callback);
|
||||
regex_grep(cl,
|
||||
start,
|
||||
end,
|
||||
expression);
|
||||
}
|
||||
</pre>
|
||||
<p></p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
427
doc/Attic/regex_iterator.html
Normal file
427
doc/Attic/regex_iterator.html
Normal file
@ -0,0 +1,427 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: regex_iterator</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link href="../../../boost.css" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">regex_iterator</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>Contents</h3>
|
||||
<dl class="index">
|
||||
<dt><a href="#synopsis">Synopsis</a> <dt><a href="#description">Description</a> <dt><a href="#examples">
|
||||
Examples</a></dt>
|
||||
</dl>
|
||||
<h3><a name="synopsis"></a>Synopsis</h3>
|
||||
<p>The iterator type regex_iterator will enumerate all of the regular expression
|
||||
matches found in some sequence: dereferencing a regex_iterator yields a
|
||||
reference to a <a href="match_results.html">match_results</a> object.</p>
|
||||
<pre>
|
||||
template <class BidirectionalIterator,
|
||||
class charT = iterator_traits<BidirectionalIterator>::value_type,
|
||||
class traits = regex_traits<charT>,
|
||||
class Allocator = allocator<charT> >
|
||||
class regex_iterator
|
||||
{
|
||||
public:
|
||||
typedef basic_regex<charT, traits, Allocator> regex_type;
|
||||
typedef match_results<BidirectionalIterator> value_type;
|
||||
typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
regex_iterator();
|
||||
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||||
const regex_type& re,
|
||||
match_flag_type m = match_default);
|
||||
regex_iterator(const regex_iterator&);
|
||||
regex_iterator& operator=(const regex_iterator&);
|
||||
bool operator==(const regex_iterator&);
|
||||
bool operator!=(const regex_iterator&);
|
||||
const value_type& operator*();
|
||||
const value_type* operator->();
|
||||
regex_iterator& operator++();
|
||||
regex_iterator operator++(int);
|
||||
};
|
||||
|
||||
</pre>
|
||||
<h3><a name="description"></a>Description</h3>
|
||||
<p>A regex_iterator is constructed from a pair of iterators, and enumerates all
|
||||
occurrences of a regular expression within that iterator range.</p>
|
||||
<pre>
|
||||
regex_iterator();
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> constructs an end of sequence regex_iterator.</p>
|
||||
<pre>
|
||||
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||||
const regex_type& re,
|
||||
match_flag_type m = match_default);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> constructs a regex_iterator that will enumerate all occurrences
|
||||
of the expression <em>re</em>, within the sequence <em>[a,b)</em>, and found
|
||||
using match flags <em>m</em>. The object <em>re</em> must exist for the
|
||||
lifetime of the regex_iterator.</p>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<pre>
|
||||
regex_iterator(const regex_iterator& that);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> constructs a copy of <code>that</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Postconditions:</b> <code>*this == that</code>.</p>
|
||||
<pre>
|
||||
regex_iterator& operator=(const regex_iterator&);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> sets <code>*this</code> equal to those in <code>that</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Postconditions:</b> <code>*this == that</code>.</p>
|
||||
<pre>
|
||||
bool operator==(const regex_iterator& that);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> returns true if *this is equal to that.</p>
|
||||
<pre>
|
||||
bool operator!=(const regex_iterator&);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> returns <code>!(*this == that)</code>.</p>
|
||||
<pre>
|
||||
const value_type& operator*();
|
||||
</pre>
|
||||
<p><b>Effects:</b> dereferencing a regex_iterator object <em>it</em> yields a
|
||||
const reference to a <a href="match_results.html">match_results</a> object,
|
||||
whose members are set as follows:</p>
|
||||
<p></p>
|
||||
<table id="Table2" cellspacing="1" cellpadding="7" width="624" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Element</b></p>
|
||||
</td>
|
||||
<td valign="top" width="50%"><b></b>
|
||||
<p><b>Value</b></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).size()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>re.mark_count()</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).empty()</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>false</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).prefix().first</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<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 valign="top" width="50%">
|
||||
<p>(*it).prefix().last</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[0].first</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).prefix().matched</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).prefix().first != (*it).prefix().second</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).suffix().first</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[0].second</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).suffix().last</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>The end of the underlying sequence.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).suffix().matched</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it).suffix().first != (*it).suffix().second</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[0].first</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>The start of the sequence of characters that matched the regular expression</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[0].second</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>The end of the sequence of characters that matched the regular expression</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[0].matched</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p><code>true</code> if a full match was found, and <code>false</code> if it was a
|
||||
partial match (found as a result of the <code>match_partial</code> flag being
|
||||
set).</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[n].first</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>For all integers n < (*it).size(), the start of the sequence that matched
|
||||
sub-expression <i>n</i>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <i>last</i>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[n].second</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>For all integers n < (*it).size(), the end of the sequence that matched
|
||||
sub-expression <i>n</i>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <i>last</i>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<p>(*it)[n].matched</p>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<p>For all integers n < (*it).size(), true if sub-expression <i>n</i> participated
|
||||
in the match, false otherwise.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%">(*it).position(n)</td>
|
||||
<td valign="top" width="50%">For all integers n < (*it).size(), then the
|
||||
distance from the start of the underlying sequence to the start of
|
||||
sub-expression match <em>n</em>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<pre>
|
||||
const value_type* operator->();
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> returns <code>&(*this)</code>.</p>
|
||||
<pre>
|
||||
regex_iterator& operator++();
|
||||
</pre>
|
||||
<p><strong>Effects:</strong> 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
|
||||
regex_iterator 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><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<b></b>
|
||||
<p><b>Returns:</b> <code>*this</code>.</p>
|
||||
<pre>
|
||||
regex_iterator operator++(int);
|
||||
</pre>
|
||||
<b></b>
|
||||
<p><b>Effects:</b> constructs a copy <code>result</code> of <code>*this</code>,
|
||||
then calls <code>++(*this)</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Returns:</b> <code>result</code>.</p>
|
||||
<h3>Examples</h3>
|
||||
<p>The following <a href="../example/snippets/regex_iterator_example.cpp">example</a>
|
||||
takes a C++ source file and builds up an index of class names, and the location
|
||||
of that class in the file.</p>
|
||||
<pre>
|
||||
<font color="#008040">#include <string></font>
|
||||
<font color="#008040">#include <map></font>
|
||||
<font color="#008040">#include <fstream></font>
|
||||
<font color="#008040">#include <iostream></font>
|
||||
<font color="#008040">#include <boost/regex.hpp></font>
|
||||
|
||||
<b>using</b> <b>namespace</b> std;
|
||||
|
||||
<i><font color="#000080">// purpose:</font></i>
|
||||
<i><font color=
|
||||
#000080>// takes the contents of a file in the form of a string</font></i>
|
||||
<i><font color=
|
||||
#000080>// and searches for all the C++ class definitions, storing</font></i>
|
||||
<i><font color=
|
||||
#000080>// their locations in a map of strings/int's</font></i>
|
||||
|
||||
<b>typedef</b> std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
|
||||
|
||||
<b>const</b> <b>char</b>* re =
|
||||
<i><font color=
|
||||
#000080>// possibly leading whitespace: </font></i>
|
||||
<font color="#0000ff">"^[[:space:]]*"</font>
|
||||
<i><font color=
|
||||
#000080>// possible template declaration:</font></i>
|
||||
<font color=
|
||||
#0000ff>"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"</font>
|
||||
<i><font color="#000080">// class or struct:</font></i>
|
||||
<font color="#0000ff">"(class|struct)[[:space:]]*"</font>
|
||||
<i><font color=
|
||||
#000080>// leading declspec macros etc:</font></i>
|
||||
<font color="#0000ff">"("</font>
|
||||
<font color="#0000ff">"\\<\\w+\\>"</font>
|
||||
<font color="#0000ff">"("</font>
|
||||
<font color="#0000ff">"[[:blank:]]*\\([^)]*\\)"</font>
|
||||
<font color="#0000ff">")?"</font>
|
||||
<font color="#0000ff">"[[:space:]]*"</font>
|
||||
<font color="#0000ff">")*"</font>
|
||||
<i><font color="#000080">// the class name</font></i>
|
||||
<font color="#0000ff">"(\\<\\w*\\>)[[:space:]]*"</font>
|
||||
<i><font color=
|
||||
#000080>// template specialisation parameters</font></i>
|
||||
<font color="#0000ff">"(<[^;:{]+>)?[[:space:]]*"</font>
|
||||
<i><font color="#000080">// terminate in { or :</font></i>
|
||||
<font color="#0000ff">"(\\{|:[^;\\{()]*\\{)"</font>;
|
||||
|
||||
|
||||
boost::regex expression(re);
|
||||
map_type class_index;
|
||||
|
||||
<b>bool</b> regex_callback(<b>const</b> boost::match_results<std::string::const_iterator>& what)
|
||||
{
|
||||
<i><font color=
|
||||
#000080>// what[0] contains the whole string</font></i>
|
||||
<i><font color=
|
||||
#000080>// what[5] contains the class name.</font></i>
|
||||
<i><font color=
|
||||
#000080>// what[6] contains the template specialisation if any.</font></i>
|
||||
<i><font color=
|
||||
#000080>// add class name and position to map:</font></i>
|
||||
class_index[what[<font color=
|
||||
#0000a0>5</font>].str() + what[<font color=
|
||||
#0000a0>6</font>].str()] = what.position(<font color=
|
||||
#0000a0>5</font>);
|
||||
<b>return</b> <b>true</b>;
|
||||
}
|
||||
|
||||
<b>void</b> load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
<b>char</b> c;
|
||||
<b>while</b>(is.get(c))
|
||||
{
|
||||
<b>if</b>(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * <font color="#0000a0">3</font>);
|
||||
s.append(<font color="#0000a0">1</font>, c);
|
||||
}
|
||||
}
|
||||
|
||||
<b>int</b> main(<b>int</b> argc, <b>const</b> <b>char</b>** argv)
|
||||
{
|
||||
std::string text;
|
||||
<b>for</b>(<b>int</b> i = <font color=
|
||||
#0000a0>1</font>; i < argc; ++i)
|
||||
{
|
||||
cout << <font color=
|
||||
#0000ff>"Processing file "</font> << argv[i] << endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
<i><font color=
|
||||
#000080>// construct our iterators:</font></i>
|
||||
boost::regex_iterator<std::string::const_iterator> m1(text.begin(), text.end(), expression);
|
||||
boost::regex_iterator<std::string::const_iterator> m2;
|
||||
std::for_each(m1, m2, <20>ex_callback);
|
||||
<i><font color="#000080">// copy results:</font></i>
|
||||
cout << class_index.size() << <font color=
|
||||
#0000ff>" matches found"</font> << endl;
|
||||
map_type::iterator c, d;
|
||||
c = class_index.begin();
|
||||
d = class_index.end();
|
||||
<b>while</b>(c != d)
|
||||
{
|
||||
cout << <font color=
|
||||
#0000ff>"class \""</font> << (*c).first << <font
|
||||
color=
|
||||
#0000ff>"\" found at index: "</font> << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
class_index.erase(class_index.begin(), class_index.end());
|
||||
}
|
||||
<b>return</b> <font color="#0000a0">0</font>;
|
||||
}
|
||||
</pre>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
317
doc/Attic/regex_match.html
Normal file
317
doc/Attic/regex_match.html
Normal file
@ -0,0 +1,317 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_match</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Algorithm regex_match</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<H3>Contents</H3>
|
||||
<dl class="index">
|
||||
<dt><a href="#synopsis">Synopsis</a> <dt><a href="#description">Description</a> <dt><a href="#examples">
|
||||
Examples</a></dt>
|
||||
</dl>
|
||||
<H3><A name="synopsis"></A>Synopsis</H3>
|
||||
<PRE><A name=query_match></A>#include <<A href="../../boost/regex.hpp">boost/regex.hpp</A>> </PRE>
|
||||
<P>The algorithm regex _match determines whether a given regular expression
|
||||
matches a given sequence denoted by a pair of bidirectional-iterators, the
|
||||
algorithm is defined as follows, <STRONG>note that the result is true only if the
|
||||
expression matches the whole of the input sequence</STRONG>, the main use of
|
||||
this function is data input validation.
|
||||
<PRE>template <class BidirectionalIterator, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||||
<A href="match_results.html">match_results</A><BidirectionalIterator, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
|
||||
template <class BidirectionalIterator, class charT, class traits, class Allocator2>
|
||||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
|
||||
template <class charT, class Allocator, class traits, class Allocator2>
|
||||
bool regex_match(const charT* str, <A href="match_results.html">match_results</A><const charT*, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
|
||||
template <class ST, class SA, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||||
<A href="match_results.html">match_results</A><typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
|
||||
template <class charT, class traits, class Allocator2>
|
||||
bool regex_match(const charT* str,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
|
||||
template <class ST, class SA, class charT, class traits, class Allocator2>
|
||||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<PRE>template <class BidirectionalIterator, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||||
<A href="match_results.html">match_results</A><BidirectionalIterator, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Requires:</B> Type BidirectionalIterator meets the requirements of a
|
||||
Bidirectional Iterator (24.1.4).</P>
|
||||
<P><B> Effects: </B>Determines whether there is an exact match between the regular
|
||||
expression <I>e</I>, and all of the character sequence [first, last), parameter <I>
|
||||
flags</I> is used to <A href="match_flag_type.html">control how the expression
|
||||
is matched</A> against the character sequence. Returns true if such a match
|
||||
exists, false otherwise.</P>
|
||||
<P><STRONG>Throws:</STRONG> <code>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<P><B> Postconditions: </B>If the function returns false, then the effect on
|
||||
parameter <I>m</I> is undefined, otherwise the effects on parameter <I>m</I> are
|
||||
given in the table:</P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><B> Element</B>
|
||||
</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><B> Value</B>
|
||||
</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.size()</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>e.mark_count()</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.empty()</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>false</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>first</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().last</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>first</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>false</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>last</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().last</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>last</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>false</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>first</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].second</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>last</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><CODE> true</CODE> if a full match was found, and <CODE>false</CODE> if it was
|
||||
a partial match (found as a result of the <CODE>match_partial</CODE> flag being
|
||||
set).</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), the start of the sequence that matched
|
||||
sub-expression <I>n</I>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <I>last</I>.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].second</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), the end of the sequence that matched
|
||||
sub-expression <I>n</I>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <I>last</I>.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), true if sub-expression <I>n</I> participated
|
||||
in the match, false otherwise.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
</TBODY></TD></TR></TABLE>
|
||||
</CENTER>
|
||||
<P></P>
|
||||
<DIV></DIV>
|
||||
<PRE> </PRE>
|
||||
<PRE>template <class BidirectionalIterator, class charT, class traits, class Allocator2>
|
||||
bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Behaves "as if" by constructing an instance of <CODE><A href="match_results.html">
|
||||
match_results</A><</CODE>BidirectionalIterator<CODE>> what</CODE>,
|
||||
and then returning the result of <CODE>regex_match(first, last, what, e, flags)</CODE>.</P>
|
||||
<PRE>template <class charT, class Allocator, class traits, class Allocator2>
|
||||
bool regex_match(const charT* str, <A href="match_results.html">match_results</A><const charT*, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_match(str, str +
|
||||
char_traits<charT>::length(str), m, e, flags)</CODE>.</P>
|
||||
<PRE>template <class ST, class SA, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||||
<A href="match_results.html">match_results</A><typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_match(s.begin(), s.end(), m, e,
|
||||
flags)</CODE>.</P>
|
||||
<PRE>template <class charT, class traits, class Allocator2>
|
||||
bool regex_match(const charT* str,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_match(str, str +
|
||||
char_traits<charT>::length(str), e, flags)</CODE>.</P>
|
||||
<PRE>template <class ST, class SA, class charT, class traits, class Allocator2>
|
||||
bool regex_match(const basic_string<charT, ST, SA>& s,
|
||||
const <A href="basic_regex.html">basic_regex</A><charT, traits, Allocator2>& e,
|
||||
<A href="match_flag_type.html">match_flag_type</A> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_match(s.begin(), s.end(), e,
|
||||
flags)</CODE>.
|
||||
<H3><A name="examples"></A>Examples</H3>
|
||||
<P>The following <A href="../example/snippets/regex_match_example.cpp">example</A>
|
||||
processes an ftp response:
|
||||
<P></P>
|
||||
<PRE><FONT color=#008000>#include <stdlib.h>
|
||||
#include <boost/regex.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
</FONT><B>using namespace</B> boost;
|
||||
|
||||
regex expression(<FONT color=#000080>"([0-9]+)(\\-| |$)(.*)"</FONT>);
|
||||
|
||||
<FONT color=#000080><I>// process_ftp:
|
||||
// on success returns the ftp response code, and fills
|
||||
// msg with the ftp response message.
|
||||
</I></FONT><B>int</B> process_ftp(<B>const</B> <B>char</B>* response, std::string* msg)
|
||||
{
|
||||
cmatch what;
|
||||
<B>if</B>(regex_match(response, what, expression))
|
||||
{
|
||||
<FONT color=#000080> <I>// what[0] contains the whole string
|
||||
</I> <I>// what[1] contains the response code
|
||||
</I> <I>// what[2] contains the separator character
|
||||
</I> <I>// what[3] contains the text message.
|
||||
</I></FONT> <B>if</B>(msg)
|
||||
msg->assign(what[3].first, what[3].second);
|
||||
<B>return</B> std::atoi(what[1].first);
|
||||
}
|
||||
<FONT color=#000080> <I>// failure did not match
|
||||
</I></FONT> <B>if</B>(msg)
|
||||
msg->erase();
|
||||
<B>return</B> -1;
|
||||
}
|
||||
<P>
|
||||
<HR></PRE>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
47
doc/Attic/regex_merge.html
Normal file
47
doc/Attic/regex_merge.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_merge (deprecated)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Algorithm regex_merge (deprecated)</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Algorithm regex_merge has been renamed <A href="regex_replace.html">regex_replace</A>,
|
||||
existing code will continue to compile, but new code should use <A href="regex_replace.html">
|
||||
regex_replace</A> instead.</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
213
doc/Attic/regex_replace.html
Normal file
213
doc/Attic/regex_replace.html
Normal file
@ -0,0 +1,213 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_replace</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td vAlign="top" width="300">
|
||||
<h3><A href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></A></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Algorithm regex_replace</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<H3>Contents</H3>
|
||||
<dl class="index">
|
||||
<dt><A href="#synopsis">Synopsis</A> <dt><a href="#description">Description</a> <dt><A href="#examples">
|
||||
Examples</A></dt></dl>
|
||||
<H3><A name="synopsis"></A>Synopsis</H3>
|
||||
<PRE>#include <<A href="../../../boost/regex.hpp">boost/regex.hpp</A>> </PRE>
|
||||
<P>The algorithm regex_replace searches through a string finding
|
||||
all the matches to the regular expression: for each match it then calls <A href="match_results.html">
|
||||
match_results::format</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 <EM>flags</EM> parameter does not have the flag <A href="match_flags.html">
|
||||
format_no_copy</A> set. If the flag <A href="match_flags.html">format_first_only</A>
|
||||
is set then only the first occurrence is replaced rather than all
|
||||
occurrences. <PRE>template <class OutputIterator, class BidirectionalIterator, class traits,
|
||||
class Allocator, class charT>
|
||||
OutputIterator regex_replace(OutputIterator out,
|
||||
BidirectionalIterator first,
|
||||
BidirectionalIterator last,
|
||||
const basic_regex<charT, traits, Allocator>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
basic_string<charT> regex_replace(const basic_string<charT>& s,
|
||||
const basic_regex<charT, traits, Allocator>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<PRE>template <class OutputIterator, class BidirectionalIterator, class traits,
|
||||
class Allocator, class charT>
|
||||
OutputIterator regex_replace(OutputIterator out,
|
||||
BidirectionalIterator first,
|
||||
BidirectionalIterator last,
|
||||
const basic_regex<charT, traits, Allocator>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Finds all the non-overlapping matches <I>m</I> of type <CODE>match_results<BidirectionalIterator>
|
||||
</CODE>that occur within the sequence [first, last). If no such matches are
|
||||
found and <CODE>!(flags & format_no_copy)</CODE> then calls <CODE>std::copy(first,
|
||||
last, out)</CODE>. Otherwise, for each match found, if <CODE>!(flags &
|
||||
format_no_copy)</CODE> calls <CODE>std::copy(m.prefix().first, m.prefix().last,
|
||||
out)</CODE>, and then calls <CODE>m.format(out, fmt, flags)</CODE>. Finally
|
||||
if <CODE>!(flags & format_no_copy)</CODE> calls <CODE>std::copy(last_m.suffix().first,
|
||||
last_m,suffix().last, out) </CODE>where <CODE>last_m</CODE> is a copy of the
|
||||
last match found. If <CODE>flags & format_first_only</CODE> is non-zero
|
||||
then only the first match found is replaced.</P>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<P><B> Returns:</B> <CODE>out</CODE>.
|
||||
</P>
|
||||
<PRE>template <class traits, class Allocator, class charT>
|
||||
basic_string<charT> regex_replace(const basic_string<charT>& s,
|
||||
const basic_regex<charT, traits, Allocator>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Constructs an object <CODE>basic_string<charT> result</CODE>,
|
||||
calls <CODE>regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt,
|
||||
flags)</CODE>, and then returns <CODE>result</CODE>.
|
||||
<H3><A name="examples"></A>Examples</H3>
|
||||
<P>The following <A href="../example/snippets/regex_replace_example.cpp">example</A>
|
||||
takes C/C++ source code as input, and outputs syntax highlighted HTML code.</P>
|
||||
<P></P>
|
||||
<PRE><FONT color=#008080>#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <boost/regex.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
</FONT>
|
||||
<FONT color=#000080><I>// purpose:
|
||||
// takes the contents of a file and transform to
|
||||
// syntax highlighted code in html format
|
||||
</I></FONT>
|
||||
boost::regex e1, e2;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* expression_text;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* format_string;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* pre_expression;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* pre_format;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* header_text;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* footer_text;
|
||||
|
||||
<B>void</B> load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
<B>char</B> c;
|
||||
<B>while</B>(is.get(c))
|
||||
{
|
||||
<B>if</B>(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * <FONT color=#000080>3</FONT>);
|
||||
s.append(<FONT color=#000080>1</FONT>, c);
|
||||
}
|
||||
}
|
||||
|
||||
<B>int</B> main(<B>int</B> argc, <B>const</B> <B>char</B>** argv)
|
||||
{
|
||||
try{
|
||||
e1.assign(expression_text);
|
||||
e2.assign(pre_expression);
|
||||
<B>for</B>(<B>int</B> i = <FONT color=#000080>1</FONT>; i < argc; ++i)
|
||||
{
|
||||
std::cout << <FONT color=#0000ff>"Processing file "</FONT> << argv[i] << std::endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
std::string in;
|
||||
load_file(in, fs);
|
||||
std::string out_name(std::string(argv[i]) + std::string(<FONT color=#0000ff>".htm"</FONT>));
|
||||
std::ofstream os(out_name.c_str());
|
||||
os << header_text;
|
||||
<FONT color=#000080><I>// strip '<' and '>' first by outputting to a
|
||||
</I></FONT> <FONT color=#000080><I>// temporary string stream
|
||||
</I></FONT> std::ostringstream t(std::ios::out | std::ios::binary);
|
||||
std::ostream_iterator<<B>char</B>, <B>char</B>> oi(t);
|
||||
boost::regex_replace(oi, in.begin(), in.end(),
|
||||
e2, pre_format, boost::match_default | boost::format_all);
|
||||
<FONT color=#000080><I>// then output to final output stream
|
||||
</I></FONT> <FONT color=#000080><I>// adding syntax highlighting:
|
||||
</I></FONT> std::string s(t.str());
|
||||
std::ostream_iterator<<B>char</B>, <B>char</B>> out(os);
|
||||
boost::regex_replace(out, s.begin(), s.end(),
|
||||
e1, format_string, boost::match_default | boost::format_all);
|
||||
os << footer_text;
|
||||
}
|
||||
}
|
||||
<STRONG>catch</STRONG>(...)
|
||||
{ <STRONG>return</STRONG> -1; }
|
||||
<B>return</B> <FONT color=#000080>0</FONT>;
|
||||
}
|
||||
|
||||
<B>extern</B> <B>const</B> <B>char</B>* pre_expression = <FONT color=#0000ff>"(<)|(>)|\\r"</FONT>;
|
||||
<B>extern</B> <B>const</B> <B>char</B>* pre_format = <FONT color=#0000ff>"(?1<)(?2>)"</FONT>;
|
||||
|
||||
|
||||
<B>const</B> <B>char</B>* expression_text = <FONT color=#000080><I>// preprocessor directives: index 1
|
||||
</I></FONT> <FONT color=#0000ff>"(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|"
|
||||
</FONT> <FONT color=#000080><I>// comment: index 2
|
||||
</I></FONT> <FONT color=#0000ff>"(//[^\\n]*|/\\*.*?\\*/)|"
|
||||
</FONT> <FONT color=#000080><I>// literals: index 3
|
||||
</I></FONT> <FONT color=#0000ff>"\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"
|
||||
</FONT> <FONT color=#000080><I>// string literals: index 4
|
||||
</I></FONT> <FONT color=#0000ff>"('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"
|
||||
</FONT> <FONT color=#000080><I>// keywords: index 5
|
||||
</I></FONT> <FONT color=#0000ff>"\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
|
||||
</FONT> <FONT color=#0000ff>"|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
|
||||
</FONT> <FONT color=#0000ff>"|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
|
||||
</FONT> <FONT color=#0000ff>"|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
|
||||
</FONT> <FONT color=#0000ff>"|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
|
||||
</FONT> <FONT color=#0000ff>"|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
|
||||
</FONT> <FONT color=#0000ff>"|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
|
||||
</FONT> <FONT color=#0000ff>"|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
|
||||
</FONT> <FONT color=#0000ff>"|using|virtual|void|volatile|wchar_t|while)\\>"
|
||||
</FONT> ;
|
||||
|
||||
<B>const</B> <B>char</B>* format_string = <FONT color=#0000ff>"(?1<font color=\"#008040\">$&</font>)"
|
||||
</FONT> <FONT color=#0000ff>"(?2<I><font color=\"#000080\">$&</font></I>)"
|
||||
</FONT> <FONT color=#0000ff>"(?3<font color=\"#0000A0\">$&</font>)"
|
||||
</FONT> <FONT color=#0000ff>"(?4<font color=\"#0000FF\">$&</font>)"
|
||||
</FONT> <FONT color=#0000ff>"(?5<B>$&</B>)"</FONT>;
|
||||
|
||||
<B>const</B> <B>char</B>* header_text = <FONT color=#0000ff>"<HTML>\n<HEAD>\n"
|
||||
</FONT> <FONT color=#0000ff>"<TITLE>Auto-generated html formated source</TITLE>\n"
|
||||
</FONT> <FONT color=#0000ff>"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
|
||||
</FONT> <FONT color=#0000ff>"</HEAD>\n"
|
||||
</FONT> <FONT color=#0000ff>"<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n"
|
||||
</FONT> <FONT color=#0000ff>"<P> </P>\n<PRE>"</FONT>;
|
||||
|
||||
<B>const</B> <B>char</B>* footer_text = <FONT color=#0000ff>"</PRE>\n</BODY>\n\n"</FONT>;
|
||||
</PRE>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
328
doc/Attic/regex_search.html
Normal file
328
doc/Attic/regex_search.html
Normal file
@ -0,0 +1,328 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_search</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td vAlign="top" width="300">
|
||||
<h3><A href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></A></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Algorithm regex_search</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<H3>Contents</H3>
|
||||
<dl class="index">
|
||||
<dt><A href="#synopsis">Synopsis</A> <dt><a href="#description">Description</a> <dt><A href="#examples">
|
||||
Examples</A></dt></dl>
|
||||
<H3><A name="synopsis"></A>Synopsis</H3>
|
||||
<PRE>#include <<A href="../../boost/regex.hpp">boost/regex.hpp</A>> </PRE>
|
||||
<P></P>
|
||||
<P>The algorithm regex_search 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:
|
||||
<PRE>template <class BidirectionalIterator,
|
||||
class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
<a href="match_results.html">match_results</a><BidirectionalIterator, Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
|
||||
template <class ST, class SA,
|
||||
class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||||
<a href="match_results.html">match_results</a><
|
||||
typename basic_string<charT, ST,SA>::const_iterator,
|
||||
Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
|
||||
template<class charT, class Allocator, class traits,
|
||||
class Allocator2>
|
||||
bool regex_search(const charT* str,
|
||||
<a href="match_results.html">match_results</a><const charT*, Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
|
||||
template <class BidirectionalIterator, class Allocator,
|
||||
class charT, class traits>
|
||||
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
|
||||
template <class charT, class Allocator,
|
||||
class traits>
|
||||
bool regex_search(const charT* str,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
|
||||
template<class ST, class SA,
|
||||
class Allocator, class charT,
|
||||
class traits>
|
||||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<PRE>template <class BidirectionalIterator, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
<a href="match_results.html">match_results</a><BidirectionalIterator, Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Requires:</B> Type BidirectionalIterator meets the requirements of a
|
||||
Bidirectional Iterator (24.1.4).</P>
|
||||
<P><B> Effects: </B>Determines whether there is some sub-sequence within
|
||||
[first,last) that matches the regular expression <I>e</I>, parameter <I>flags</I>
|
||||
is used to control how the expression is matched against the character
|
||||
sequence. Returns true if such a sequence exists, false otherwise.</P>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<P><B> Postconditions: </B>If the function returns false, then the effect on
|
||||
parameter <I>m</I> is undefined, otherwise the effects on parameter <I>m</I> are
|
||||
given in the table:</P>
|
||||
<DIV align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><B> Element</B></P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><B> Value</B>
|
||||
</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.size()</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>e.mark_count()</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.empty()</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>false</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>first</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().last</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].first</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.prefix().first != m.prefix().second</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].second</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().last</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>last</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m.suffix().first != m.suffix().second</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>The start of the sequence of characters that matched the regular expression</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].second</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>The end of the sequence of characters that matched the regular expression</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[0].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P><CODE> true</CODE> if a full match was found, and <CODE>false</CODE> if it was
|
||||
a partial match (found as a result of the <CODE>match_partial</CODE> flag being
|
||||
set).</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].first</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), the start of the sequence that matched
|
||||
sub-expression <I>n</I>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <I>last</I>.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].second</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), the end of the sequence that matched
|
||||
sub-expression <I>n</I>. Alternatively, if sub-expression n did not participate
|
||||
in the match, then <I>last</I>.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>m[n].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < m.size(), true if sub-expression <I>n</I> participated
|
||||
in the match, false otherwise.</P>
|
||||
</TD>
|
||||
</TR>
|
||||
</TD></TR></TABLE>
|
||||
</CENTER>
|
||||
</DIV>
|
||||
<PRE>template <class charT, class Allocator, class traits, class Allocator2>
|
||||
bool regex_search(const charT* str, <a href="match_results.html">match_results</a><const charT*, Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_search(str, str +
|
||||
char_traits<charT>::length(str), m, e, flags)</CODE>.</P>
|
||||
<PRE>template <class ST, class SA, class Allocator, class charT,
|
||||
class traits, class Allocator2>
|
||||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||||
<a href="match_results.html">match_results</a><typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator2>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_search(s.begin(), s.end(), m,
|
||||
e, flags)</CODE>.</P>
|
||||
<PRE>template <class iterator, class Allocator, class charT,
|
||||
class traits>
|
||||
bool regex_search(iterator first, iterator last,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Behaves "as if" by constructing an instance of <CODE><a href="match_results.html">
|
||||
match_results</a><</CODE>BidirectionalIterator<CODE>> what</CODE>,
|
||||
and then returning the result of <CODE>regex_search(first, last, what, e, flags)</CODE>.</P>
|
||||
<PRE>template <class charT, class Allocator, class traits>
|
||||
bool regex_search(const charT* str
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_search(str, str +
|
||||
char_traits<charT>::length(str), e, flags)</CODE>.</P>
|
||||
<PRE>template <class ST, class SA, class Allocator, class charT,
|
||||
class traits>
|
||||
bool regex_search(const basic_string<charT, ST, SA>& s,
|
||||
const <a href="basic_regex.html">basic_regex</a><charT, traits, Allocator>& e,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = match_default);</PRE>
|
||||
<P><B> Effects:</B> Returns the result of <CODE>regex_search(s.begin(), s.end(), e,
|
||||
flags)</CODE>.
|
||||
<H3><A name="examples"></A>Examples</H3>
|
||||
<P>The following <A href="../example/snippets/regex_search_example.cpp">example</A>,
|
||||
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 std::string is implemented, for example it could easily be modified to
|
||||
work with the SGI rope class, which uses a non-contiguous storage strategy.</P>
|
||||
<P></P>
|
||||
<PRE><FONT color=#008000>#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
</FONT><FONT color=#000080><I>
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
</I></FONT><B>typedef</B> std::map<std::string, <B>int</B>, std::less<std::string> > map_type;
|
||||
|
||||
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)");
|
||||
<B>
|
||||
void</B> IndexClasses(map_type& m, <B>const</B> std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
boost::<a href="match_results.html">match_results</a><std::string::const_iterator> what;
|
||||
<B>unsigned</B> <B>int</B> flags = boost::match_default;
|
||||
<B>while</B>(regex_search(start, end, what, expression, flags))
|
||||
{
|
||||
<FONT color=#000080> <I>// what[0] contains the whole string
|
||||
</I> <I>// what[5] contains the class name.
|
||||
</I> <I>// what[6] contains the template specialisation if any.
|
||||
</I> <I>// add class name and position to map:
|
||||
</I></FONT> m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - file.begin();
|
||||
<FONT color=#000080><I>// update search position:
|
||||
</I></FONT> start = what[0].second;
|
||||
<FONT color=#000080><I>// update flags:
|
||||
</I></FONT> flags |= boost::match_prev_avail;
|
||||
flags |= boost::match_not_bob;
|
||||
}
|
||||
}
|
||||
</PRE>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
148
doc/Attic/regex_split.html
Normal file
148
doc/Attic/regex_split.html
Normal file
@ -0,0 +1,148 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Algorithm regex_split (deprecated)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Algorithm regex_split (deprecated)</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>The algorithm regex_split has been deprecated in favor of the iterator <A href="regex_token_iterator.html">
|
||||
regex_token_iterator</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 regex_split will continue to compile, the following
|
||||
documentation is taken from the previous boost.regex version:</P>
|
||||
<H3><A name="regex_split"></A>Algorithm regex_split</H3>
|
||||
<PRE>#include <<A href="../../../boost/regex.hpp">boost/regex.hpp</A>> </PRE>
|
||||
<P>Algorithm regex_split performs a similar operation to the perl split operation,
|
||||
and comes in three overloaded forms:
|
||||
</P>
|
||||
<PRE><B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||
std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||
<B> unsigned</B> flags,
|
||||
std::size_t max_split);
|
||||
|
||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||
std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||
<B>unsigned</B> flags = match_default);
|
||||
|
||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1>
|
||||
std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s);</PRE>
|
||||
<P><STRONG>Effects: </STRONG>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 <I>max_split </I>strings will be written to the
|
||||
output-iterator. Before returning, all the input processed will be deleted from
|
||||
the string <I>s</I> (if <I>max_split </I>is not reached then all of <I>s</I> will
|
||||
be deleted). Returns the number of strings written to the output-iterator. If
|
||||
the parameter <I>max_split</I> is not specified then it defaults to UINT_MAX.
|
||||
If no expression is specified, then it defaults to "\s+", and splitting occurs
|
||||
on whitespace.
|
||||
</P>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<P><A href="../example/snippets/regex_split_example_1.cpp">Example</A>: the
|
||||
following function will split the input string into a series of tokens, and
|
||||
remove each token from the string <I>s</I>:
|
||||
</P>
|
||||
<PRE><B>unsigned</B> tokenise(std::list<std::string>& l, std::string& s)
|
||||
{
|
||||
<B> return</B> boost::regex_split(std::back_inserter(l), s);
|
||||
}</PRE>
|
||||
<P><A href="../example/snippets/regex_split_example_2.cpp">Example</A>: the
|
||||
following short program will extract all of the URL's from a html file, and
|
||||
print them out to <I>cout</I>:
|
||||
</P>
|
||||
<PRE><FONT color=#008000>#include <list>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <boost/regex.hpp>
|
||||
</FONT>
|
||||
boost::regex e(<FONT color=#000080>"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\""</FONT>,
|
||||
boost::regbase::normal | boost::regbase::icase);
|
||||
|
||||
<B>void</B> load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
<FONT color=#000080>//
|
||||
// attempt to grow string buffer to match file size,
|
||||
// this doesn't always work...
|
||||
</FONT> s.reserve(is.rdbuf()-&gtin_avail());
|
||||
<B>char</B> c;
|
||||
<B>while</B>(is.get(c))
|
||||
{
|
||||
<FONT color=#000080>// use logarithmic growth stategy, in case
|
||||
// in_avail (above) returned zero:
|
||||
</FONT> <B>if</B>(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<B>int</B> main(<B>int</B> argc, <B>char</B>** argv)
|
||||
{
|
||||
std::string s;
|
||||
std::list<std::string> l;
|
||||
|
||||
<B>for</B>(<B>int</B> i = 1; i < argc; ++i)
|
||||
{
|
||||
std::cout << <FONT color=#000080>"Findings URL's in "</FONT> << argv[i] << <FONT color=#000080>":"</FONT> << std::endl;
|
||||
s.erase();
|
||||
std::ifstream is(argv[i]);
|
||||
load_file(s, is);
|
||||
boost::regex_split(std::back_inserter(l), s, e);
|
||||
<B>while</B>(l.size())
|
||||
{
|
||||
s = *(l.begin());
|
||||
l.pop_front();
|
||||
std::cout << s << std::endl;
|
||||
}
|
||||
}
|
||||
<B>return</B> 0;
|
||||
}</PRE>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
286
doc/Attic/regex_token_iterator.html
Normal file
286
doc/Attic/regex_token_iterator.html
Normal file
@ -0,0 +1,286 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: regex_token_iterator</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td vAlign="top" width="300">
|
||||
<h3><A href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></A></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">regex_token_iterator</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<H3>Contents</H3>
|
||||
<dl class="index">
|
||||
<dt><A href="#synopsis">Synopsis</A> <dt><a href="#description">Description</a> <dt><A href="#examples">
|
||||
Examples</A></dt></dl>
|
||||
<H3><A name="synopsis"></A>Synopsis</H3>
|
||||
<P>The template class <CODE>regex_token_iterator</CODE> 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 new strings for each match found. Each position
|
||||
enumerated by the iterator is a string that represents what matched a
|
||||
particular sub-expression within the regular expression. When class <CODE>regex_token_iterator</CODE>
|
||||
is used to enumerate a single sub-expression with index -1, then the iterator
|
||||
performs field splitting: that is to say it enumerates one string for each
|
||||
section of the character container sequence that does not match the regular
|
||||
expression specified.</P>
|
||||
<PRE>
|
||||
template <class BidirectionalIterator,
|
||||
class charT = iterator_traits<BidirectionalIterator>::value_type,
|
||||
class traits = regex_traits<charT>,
|
||||
class Allocator = allocator<charT> >
|
||||
class regex_token_iterator
|
||||
{
|
||||
public:
|
||||
typedef basic_regex<charT, traits, Allocator> regex_type;
|
||||
typedef basic_string<charT> value_type;
|
||||
typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
regex_token_iterator();
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
int submatch = 0, match_flag_type m = match_default);
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const std::vector<int>& submatches, match_flag_type m = match_default);
|
||||
template <std::size_t N>
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const int (&submatches)[N], match_flag_type m = match_default);
|
||||
regex_token_iterator(const regex_token_iterator&);
|
||||
regex_token_iterator& operator=(const regex_token_iterator&);
|
||||
bool operator==(const regex_token_iterator&);
|
||||
bool operator!=(const regex_token_iterator&);
|
||||
const value_type& operator*();
|
||||
const value_type* operator->();
|
||||
regex_token_iterator& operator++();
|
||||
regex_token_iterator operator++(int);
|
||||
};
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<PRE>regex_token_iterator();</PRE>
|
||||
<P><B> Effects:</B> constructs an end of sequence iterator.</P>
|
||||
<PRE>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
int submatch = 0, match_flag_type m = match_default);</PRE>
|
||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate one
|
||||
string for each regular expression match of the expression <EM>re</EM> found
|
||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. The
|
||||
string enumerated is the sub-expression <EM>submatch </EM>for each match
|
||||
found; if <EM>submatch </EM>is -1, then enumerates all the text sequences that
|
||||
did not match the expression <EM>re </EM>(that is to performs field splitting).</P>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<PRE>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const std::vector<int>& submatches, match_flag_type m = match_default);</PRE>
|
||||
<P><B> Preconditions:</B> <CODE>submatches.size() && !re.empty()</CODE>.</P>
|
||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate <EM>submatches.size()</EM>
|
||||
strings for each regular expression match of the expression <EM>re</EM> found
|
||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. For
|
||||
each match found one string will be enumerated for each sub-expression
|
||||
index contained within <EM>submatches </EM>vector; if <EM>submatches[0] </EM>
|
||||
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><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<PRE>template <std::size_t N>
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const int (&submatches)[R], match_flag_type m = match_default);</PRE>
|
||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
||||
<P><STRONG>Effects:</STRONG></B> constructs a regex_token_iterator that will
|
||||
enumerate <EM>R</EM> strings for each regular expression match of the
|
||||
expression <EM>re</EM> found within the sequence <EM>[a,b)</EM>, using match
|
||||
flags <EM>m</EM>. For each match found one string will be
|
||||
enumerated for each sub-expression index contained within the <EM>submatches
|
||||
</EM>array; if <EM>submatches[0] </EM>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><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<PRE>regex_token_iterator(const regex_token_iterator& that);</PRE>
|
||||
<P><B> Effects: </B>constructs a copy of <CODE>that</CODE>.</P>
|
||||
<P><B> Postconditions:</B> <CODE>*this == that</CODE>.</P>
|
||||
<PRE>regex_token_iterator& operator=(const regex_token_iterator& that);</PRE>
|
||||
<P><B> Effects: </B>sets <CODE>*this</CODE> to be equal to <CODE>that</CODE>.</P>
|
||||
<P><B> Postconditions:</B> <CODE>*this == that</CODE>.</P>
|
||||
<PRE>bool operator==(const regex_token_iterator&);</PRE>
|
||||
<P>
|
||||
<B>Effects: </B>returns true if *this is the same position as that.</P>
|
||||
<PRE>bool operator!=(const regex_token_iterator&);</PRE>
|
||||
<P>
|
||||
<B>Effects: </B>returns <CODE>!(*this == that)</CODE>.</P>
|
||||
<PRE>const value_type& operator*();</PRE>
|
||||
<P>
|
||||
<B>Effects: </B>returns the current string being enumerated.</P>
|
||||
<PRE>const value_type* operator->();</PRE>
|
||||
<P>
|
||||
<B>Effects: </B>returns <CODE>&(*this)</CODE>.</P>
|
||||
<PRE>regex_token_iterator& operator++();</PRE>
|
||||
<P>
|
||||
<B>Effects: </B>Moves on to the next string to be enumerated.</P>
|
||||
<P><STRONG>Throws:</STRONG> <CODE>std::runtime_error</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 <A href="configuration.html">configured</A> in recursive mode),
|
||||
or if the matcher exhausts it's permitted memory allocation (if Boost.regex is <A href="configuration.html">
|
||||
configured</A> in non-recursive mode).</P>
|
||||
<B>
|
||||
<P>
|
||||
Returns:</B><CODE> *this</CODE>.</P><PRE>regex_token_iterator& operator++(int);</PRE>
|
||||
<P><B> Effects:</B> constructs a copy <CODE>result</CODE> of <CODE>*this</CODE>,
|
||||
then calls <CODE>++(*this)</CODE>.</P>
|
||||
<P><B> Returns:</B> <CODE>result</CODE>.<A name="examples"></A>
|
||||
<H3>Examples</H3>
|
||||
<P>The following <A href="../example/snippets/regex_token_iterator_example_1.cpp">example</A>
|
||||
takes a string and splits it into a series of tokens:</P>
|
||||
<pre>
|
||||
<FONT color=#008040>#include <iostream></FONT>
|
||||
<FONT color=#008040>#include <boost/regex.hpp></FONT>
|
||||
|
||||
<B>using</B> <B>namespace</B> std;
|
||||
|
||||
<B>int</B> main(<B>int</B> argc)
|
||||
{
|
||||
string s;
|
||||
<B>do</B>{
|
||||
<B>if</B>(argc == <FONT color=#0000a0>1</FONT>)
|
||||
{
|
||||
cout << <FONT color=#0000ff>"Enter text to split (or \"quit\" to exit): "</FONT>;
|
||||
getline(cin, s);
|
||||
<B>if</B>(s == <FONT color=#0000ff>"quit"</FONT>) <B>break</B>;
|
||||
}
|
||||
<B>else</B>
|
||||
s = <FONT color=#0000ff>"This is a string of tokens"</FONT>;
|
||||
|
||||
boost::regex re(<FONT color=#0000ff>"\\s+"</FONT>);
|
||||
boost::regex_token_iterator<std::string::const_iterator> i(s.begin(), s.end(), re, -<FONT color=#0000a0>1</FONT>);
|
||||
boost::regex_token_iterator<std::string::const_iterator> j;
|
||||
|
||||
<B>unsigned</B> count = <FONT color=#0000a0>0</FONT>;
|
||||
<B>while</B>(i != j)
|
||||
{
|
||||
cout << *i++ << endl;
|
||||
count++;
|
||||
}
|
||||
cout << <FONT color=#0000ff>"There were "</FONT> << count << <FONT color=#0000ff>" tokens found."</FONT> << endl;
|
||||
|
||||
}<B>while</B>(argc == <FONT color=#0000a0>1</FONT>);
|
||||
<B>return</B> <FONT color=#0000a0>0</FONT>;
|
||||
}
|
||||
|
||||
</pre>
|
||||
<P>The following <A href="../example/snippets/regex_token_iterator_example_2.cpp">example</A>
|
||||
takes a html file and outputs a list of all the linked files:</P>
|
||||
<pre>
|
||||
<FONT color=#008040>#include <fstream></FONT>
|
||||
<FONT color=#008040>#include <iostream></FONT>
|
||||
<FONT color=#008040>#include <iterator></FONT>
|
||||
<FONT color=#008040>#include <boost/regex.hpp></FONT>
|
||||
|
||||
boost::regex e(<FONT color=#0000ff>"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\""</FONT>,
|
||||
boost::regex::normal | boost::regbase::icase);
|
||||
|
||||
<B>void</B> load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
<I><FONT color=#000080>//</FONT></I>
|
||||
<I><FONT color=#000080>// attempt to grow string buffer to match file size,</FONT></I>
|
||||
<I><FONT color=#000080>// this doesn't always work...</FONT></I>
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
<B>char</B> c;
|
||||
<B>while</B>(is.get(c))
|
||||
{
|
||||
<I><FONT color=#000080>// use logarithmic growth stategy, in case</FONT></I>
|
||||
<I><FONT color=#000080>// in_avail (above) returned zero:</FONT></I>
|
||||
<B>if</B>(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * <FONT color=#0000a0>3</FONT>);
|
||||
s.append(<FONT color=#0000a0>1</FONT>, c);
|
||||
}
|
||||
}
|
||||
|
||||
<B>int</B> main(<B>int</B> argc, <B>char</B>** argv)
|
||||
{
|
||||
std::string s;
|
||||
<B>int</B> i;
|
||||
<B>for</B>(i = <FONT color=#0000a0>1</FONT>; i < argc; ++i)
|
||||
{
|
||||
std::cout << <FONT color=#0000ff>"Findings URL's in "</FONT> << argv[i] << <FONT color=#0000ff>":"</FONT> << std::endl;
|
||||
s.erase();
|
||||
std::ifstream is(argv[i]);
|
||||
load_file(s, is);
|
||||
boost::regex_token_iterator<std::string::const_iterator>
|
||||
i(s.begin(), s.end(), e, <FONT color=#0000a0>1</FONT>);
|
||||
boost::regex_token_iterator<std::string::const_iterator> j;
|
||||
<B>while</B>(i != j)
|
||||
{
|
||||
std::cout << *i++ << std::endl;
|
||||
}
|
||||
}
|
||||
<I><FONT color=#000080>//</FONT></I>
|
||||
<I><FONT color=#000080>// alternative method:</FONT></I>
|
||||
<I><FONT color=#000080>// test the array-literal constructor, and split out the whole</FONT></I>
|
||||
<I><FONT color=#000080>// match as well as $1....</FONT></I>
|
||||
<I><FONT color=#000080>//</FONT></I>
|
||||
<B>for</B>(i = <FONT color=#0000a0>1</FONT>; i < argc; ++i)
|
||||
{
|
||||
std::cout << <FONT color=#0000ff>"Findings URL's in "</FONT> << argv[i] << <FONT color=#0000ff>":"</FONT> << std::endl;
|
||||
s.erase();
|
||||
std::ifstream is(argv[i]);
|
||||
load_file(s, is);
|
||||
<B>const</B> <B>int</B> subs[] = {<FONT color=#0000a0>1</FONT>, <FONT color=#0000a0>0</FONT>,};
|
||||
boost::regex_token_iterator<std::string::const_iterator>
|
||||
i(s.begin(), s.end(), e, subs);
|
||||
boost::regex_token_iterator<std::string::const_iterator> j;
|
||||
<B>while</B>(i != j)
|
||||
{
|
||||
std::cout << *i++ << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
<B>return</B> <FONT color=#0000a0>0</FONT>;
|
||||
}
|
||||
</pre>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
48
doc/Attic/regex_traits.html
Normal file
48
doc/Attic/regex_traits.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: class regex_traits</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">class regex_traits</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>Under construction.</P>
|
||||
<P>The current boost.regex traits class design will be migrated to that specified
|
||||
in the <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
|
||||
expression standardization proposal</A>. </P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
17 May 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user