Final tweaks, almost ready for release...

[SVN r18400]
This commit is contained in:
John Maddock
2003-05-15 11:43:13 +00:00
parent 6104fe14eb
commit 460d2a97a9
38 changed files with 2875 additions and 2456 deletions

View File

@@ -2,76 +2,80 @@
<html> <html>
<head> <head>
<title>Boost.Regex: bad_expression</title> <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"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <link rel="stylesheet" type="text/css" href="../../../boost.css">
</head> </head>
<body> <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 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>
</P>
<HR>
<p></p> <p></p>
<H3>Synopsis</H3> <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<P>#include &lt;<A href="../../boost/regex/pattern_except.hpp">boost/pat_except.hpp</A>&gt; <tr>
</P> <td valign="top" width="300">
<P>The class <CODE>bad_expression</CODE> defines the type of objects thrown as <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 &lt;<a href="../../boost/regex/pattern_except.hpp">boost/pattern_except.hpp</a>&gt;</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 exceptions to report errors during the conversion from a string representing a
regular expression to a finite state machine.&nbsp;&nbsp;</P> regular expression to a finite state machine.&nbsp;&nbsp;</p>
<PRE><B>namespace</B> boost{ <pre>
<b>namespace</b> boost{
<B>class</B> bad_pattern : <B>public</B> std::runtime_error <b>class</b> bad_pattern : <b>public</b> std::runtime_error
{ {
<B>public</B>: <b>public</b>:
&nbsp;&nbsp; <B>explicit</B> bad_pattern(<B>const</B> std::string&amp; s) : std::runtime_error(s){}; <b>explicit</b> bad_pattern(<b>const</b> std::string&amp; s) : std::runtime_error(s){};
}; };
<B>class</B> bad_expression : <B>public</B> bad_pattern <b>class</b> bad_expression : <b>public</b> bad_pattern
{ {
<B>public</B>: <b>public</b>:
&nbsp;&nbsp; bad_expression(<B>const</B> std::string&amp; s) : bad_pattern(s) {} bad_expression(<b>const</b> std::string&amp; s) : bad_pattern(s) {}
}; };
} // namespace boost</PRE> } // namespace boost
<H3>Description</H3> </pre>
<PRE>bad_expression(const string&amp; what_arg); </PRE> <h3>Description</h3>
<P><B>Effects:</B> Constructs an object of class <CODE>bad_expression</CODE>.</P> <pre>
<B> bad_expression(const string&amp; what_arg);
<P> </pre>
Postcondition:</B> <CODE>strcmp(what(), what_arg.c_str()) == 0</CODE>. <p><b>Effects:</b> Constructs an object of class <code>bad_expression</code>.</p>
<P>Footnotes: the class <I>bad_pattern </I>forms the base class for all <b></b>
pattern-matching exceptions, of which <I>bad_expression</I> is one. The choice <p><b>Postcondition:</b> <code>strcmp(what(), what_arg.c_str()) == 0</code>.</p>
of <I>std::runtime_error </I>as the base class for <I>bad_pattern</I> <p>Footnotes: the class <i>bad_pattern</i> forms the base class for all
is moot, depending upon how the library is used exceptions may be either logic pattern-matching exceptions, of which <i>bad_expression</i> is one. The choice
errors (programmer supplied expressions) or run time errors (user supplied of <i>std::runtime_error</i> as the base class for <i>bad_pattern</i> is moot;
expressions). depending upon how the library is used exceptions may be either logic errors
<P> (programmer supplied expressions) or run time errors (user supplied
<HR> expressions).</p>
<P></P> <p></p>
<hr>
<p>Revised <p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
</p> <p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software 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 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 that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting documentation. copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software 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> for any purpose. It is provided "as is" without express or implied warranty.</i></p>
</body> </body>
</html> </html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,163 +1,245 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>
<head> <head>
<title>Boost.Regex: Configuration and setup</title> <title>Boost.Regex: Configuration and setup</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="HTML Tidy, see www.w3.org">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <meta http-equiv="Content-Type" content=
</head> "text/html; charset=iso-8859-1" >
<body> <link rel="stylesheet" type="text/css" href="../../../boost.css">
<P> </head>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> <body>
<TR> <p></p>
<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> <table id="Table1" cellspacing="1" cellpadding="1" width="100%"
</td> border="0">
<TD width="353"> <tr>
<H1 align="center">Boost.Regex</H1> <td valign="top" width="300">
<H2 align="center">Configuration and setup</H2> <h3><a href="../../../index.htm"><img height="86" width="277" alt=
</TD> "C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
<td width="50"> </td>
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> <td width="353">
</td> <h1 align="center">Boost.Regex</h1>
</TR>
</TABLE> <h2 align="center">Configuration and setup</h2>
</P> </td>
<HR> <td width="50">
<h2>Contents</h2> <h3><a href="index.html"><img height="45" width="43" alt=
<dl class="index"> "Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
<dt><a href="#compiler">Compiler setup</a></dt> </td>
<dt><a href="#locale">Locale and traits class selection</a></dt> </tr>
<dt><a href="#linkage">Linkage Options</a></dt> </table>
<dt><a href="#algorithm">Algorithm Selection</a></dt>
<dt><a href="#tuning">Algorithm Tuning</a></dt> <br>
</dl> <br>
<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 <hr>
should already take care of it, if you do have problems (or you are using a <h2>Contents</h2>
particularly obscure compiler or platform) then <A href="../../config/index.html">boost.config</A>&nbsp;has
a&nbsp;<A href="../../config/config.htm#config_script">configure</A> script.</P> <dl class="index">
<H3><A name="locale"></A>Locale and traits class selection.</H3> <dt><a href="#compiler">Compiler setup</a>
<P>The following macros (see <A href="../../../boost/regex/user.hpp">user.hpp</A>)
control how boost.regex interacts with the users locale:</P> <dt><a href="#locale">Locale and traits class selection</a>
<P>
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="1"> <dt><a href="#linkage">Linkage Options</a>
<TR>
<TD width="265">BOOST_REGEX_USE_C_LOCALE</TD> <dt><a href="#algorithm">Algorithm Selection</a>
<TD>Forces boost.regex to use the global C locale in it's traits class support:
this is the default behaviour on non-windows platforms, but MS Windows <dt><a href="#tuning">Algorithm Tuning</a></dt>
platforms normally use the Win32 API for locale support.</TD> </dl>
</TR>
<TR> <h3><a name="compiler"></a>Compiler setup.</h3>
<TD width="265">BOOST_REGEX_USE_CPP_LOCALE</TD>
<TD>Forces boost.regex to use std::locale in it's default traits class, regular <p>You shouldn't need to do anything special to configure
expressions can then be imbued with an instance&nbsp;specific locale.</TD> boost.regex for use with your compiler - the <a href="../../config/index.html">boost.config</a> subsystem should already
</TR> take care of it, if you do have problems (or you are using a
<TR> particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a>&nbsp;has a&nbsp;<a href="../../config/config.htm#config_script">configure</a> script.</p>
<TD width="265">BOOST_REGEX_NO_W32</TD>
<TD>Tells boost.regex not to use any Win32 API's even when available (implies <h3><a name="locale"></a>Locale and traits class selection.</h3>
BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).</TD>
</TR> <p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) control how
</TABLE> boost.regex interacts with the user's locale:</p>
</P>
<H3><A name="linkage"></A>Linkage Options</H3> <p></p>
<P>
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="100%" border="1"> <table id="Table2" cellspacing="1" cellpadding="1" width="100%"
<TR> border="1">
<TD>BOOST_REGEX_STATIC_LINK</TD> <tr>
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it is going <td width="265">BOOST_REGEX_USE_C_LOCALE</td>
to be linked to a static library even when using a dynamic C runtime.</TD> <td>Forces boost.regex to use the global C locale in its traits
</TR> class support: this is the default behavior on non-windows
<TR> platforms, but MS Windows platforms normally use the Win32 API for
<TD>BOOST_REGEX_NO_LIB</TD> locale support.</td>
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it should </tr>
not automatically select the library to link to.</TD>
</TR> <tr>
</TABLE> <td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
</P> <td>Forces boost.regex to use std::locale in it's default traits
<H3><A name="algorithm"></A>Algorithm Selection</H3> class, regular expressions can then be imbued with an
<P> instance&nbsp;specific locale.</td>
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="1"> </tr>
<TR>
<TD width="253">BOOST_REGEX_V3</TD> <tr>
<TD>Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if <td width="265">BOOST_REGEX_NO_W32</td>
you need maximum compatibility with previous behaviour.</TD> <td>Tells boost.regex not to use any Win32 API's even when
</TR> available (implies BOOST_REGEX_USE_C_LOCALE unless
<TR> BOOST_REGEX_USE_CPP_LOCALE is set).</td>
<TD width="253">BOOST_REGEX_RECURSIVE</TD> </tr>
<TD>Tells boost.regex to use a stack-recursive matching algorithm.&nbsp; This is </table>
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 <br>
this is not the case on other platforms.</TD> <br>
</TR>
<TR>
<TD width="253">BOOST_REGEX_NON_RECURSIVE</TD> <h3><a name="linkage"></a>Linkage Options</h3>
<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 <p></p>
pathological the regular expression.&nbsp; This is the default on non-Win32
platforms.</TD> <table id="Table3" cellspacing="1" cellpadding="1" width="100%"
</TR> border="1">
</TABLE> <tr>
</P> <td>BOOST_REGEX_DYN_LINK</td>
<H3><A name="tuning"></A>Algorithm Tuning</H3> <td>For Microsoft and Borland C++ builds, this tells
<P>The following option applies only if BOOST_REGEX_RECURSIVE is set.</P> boost.regex that it should link to the dll build of the boost.regex.&nbsp; By default
<P> boost.regex will link to its static library build, even if the dynamic C runtime library
<TABLE id="Table6" cellSpacing="1" cellPadding="1" width="100%" border="1"> is in use.</td>
<TR> </tr>
<TD>BOOST_REGEX_HAS_MS_STACK_GUARD</TD>
<TD>Tells boost.regex that Microsoft style __try - __except blocks are supported, <tr>
and can be used to safely trap stack overflow.</TD> <td>BOOST_REGEX_NO_LIB</td>
</TR> <td>For Microsoft and Borland C++ builds, this tells boost.regex
</TABLE> that it should not automatically select the library to link
</P> to.</td>
<P>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</P> </tr>
<P> </table>
<TABLE id="Table5" cellSpacing="1" cellPadding="1" width="100%" border="1">
<TR> <br>
<TD>BOOST_REGEX_BLOCKSIZE</TD> <br>
<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.&nbsp; This defaults to 4096 bytes, which is <h3><a name="algorithm"></a>Algorithm Selection</h3>
large enough to match the vast majority of regular expressions&nbsp;without
further allocations, however, you can choose smaller or larger values depending <p></p>
upon your platforms characteristics.</TD>
</TR> <table id="Table4" cellspacing="1" cellpadding="1" width="100%"
<TR> border="1">
<TD>BOOST_REGEX_MAX_BLOCKS</TD> <tr>
<TD>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is <td width="253">BOOST_REGEX_V3</td>
permitted to use.&nbsp; If this value is exceeded then boost.regex will stop <td>Tells boost.regex to use the boost-1.30.0 matching algorithm,
trying to find a match and throw a std::runtime_error.&nbsp; Defaults to 1024, define only if you need maximum compatibility with previous
don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</TD> behavior.</td>
</TR> </tr>
<TR>
<TD>BOOST_REGEX_MAX_CACHE_BLOCKS</TD> <tr>
<TD>Tells boost.regex how many memory blocks to store in it's internal cache - <td width="253">BOOST_REGEX_RECURSIVE</td>
memory blocks are taken from this cache rather than by calling ::operator <td>Tells boost.regex to use a stack-recursive matching
new.&nbsp; Generally speeking this can be an order of magnitude faster than algorithm.&nbsp; This is generally the fastest option (although
calling ::opertator new each time a memory block is required, but has the there is very little in it), but can cause stack overflow in
downside that boost.regex can end up caching a large chunk of memory (by extreme cases, on Win32 this can be handled safely, but this is not
default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).&nbsp; If memory is the case on other platforms.</td>
tight then try defining this to 0 (disables all caching), or if that is too </tr>
slow, then a value of 1 or 2, may be sufficient.&nbsp; On the other hand, on
large multi-processor, multi-threaded systems, you may find that a higher value <tr>
is in order.</TD> <td width="253">BOOST_REGEX_NON_RECURSIVE</td>
</TR> <td>Tells boost.regex to use a non-stack recursive matching
</TABLE> algorithm, this can be slightly slower than the alternative, but is
</P> always safe no matter how pathological the regular
<P> expression.&nbsp; This is the default on non-Win32 platforms.</td>
<HR> </tr>
<P></P> </table>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <br>
11 April 2003 <br>
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <h3><a name="tuning"></a>Algorithm Tuning</h3>
<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 <p>The following option applies only if BOOST_REGEX_RECURSIVE is
that the above copyright notice appear in all copies and that both that set.</p>
copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software <p></p>
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
</body> <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>
<p></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.&nbsp;
This defaults to 4096 bytes, which is large enough to match the
vast majority of regular expressions&nbsp;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.&nbsp; If this value is exceeded then
boost.regex will stop trying to find a match and throw a
std::runtime_error.&nbsp; 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.&nbsp; 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).&nbsp; 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.&nbsp; 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>
<p></p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->11
April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
Maddock</a>&nbsp;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> </html>

View File

@@ -1,86 +1,111 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>
<head> <head>
<title>Boost.Regex: Contacts</title> <title>Boost.Regex: Contacts</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="HTML Tidy, see www.w3.org">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <meta http-equiv="Content-Type" content=
</head> "text/html; charset=iso-8859-1" >
<body> <link rel="stylesheet" type="text/css" href="../../../boost.css">
<P> </head>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> <body>
<TR> <p></p>
<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> <table id="Table1" cellspacing="1" cellpadding="1" width="100%"
</td> border="0">
<TD width="353"> <tr>
<H1 align="center">Boost.Regex</H1> <td valign="top" width="300">
<H2 align="center">Contacts and Acknowledgements</H2> <h3><a href="../../../index.htm"><img height="86" width="277" alt=
</TD> "C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
<td width="50"> </td>
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> <td width="353">
</td> <h1 align="center">Boost.Regex</h1>
</TR>
</TABLE> <h2 align="center">Contacts and Acknowledgements</h2>
</P> </td>
<HR> <td width="50">
<p></p> <h3><a href="index.html"><img height="45" width="43" alt=
<P>The author can be contacted at <A href="mailto:John_Maddock@compuserve.com">John_Maddock@compuserve.com</A>, "Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
the home page for this library is at <A href="http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm"> </td>
http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm</A>, and </tr>
the official boost version can be obtained from <A href="../libraries.htm">www.boost.org/libraries.htm</A>. </table>
</P>
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think <br>
about algorithms and their performance, and to the folks at boost for forcing <br>
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 <hr>
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias <p>The author can be contacted at <a href="mailto:john_maddock@compuserve.com">
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, john_maddock@compuserve.com</a>, the home page for this library is
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens at <a href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm</a>,
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc and the official boost version can be obtained from <a href="../libraries.htm">www.boost.org/libraries.htm</a>.</p>
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 <p>I am indebted to Robert Sedgewick's "Algorithms in C++" for
supplied with the Henry Spencer, Perl and GNU regular expression libraries - forcing me to think about algorithms and their performance, and to
wherever possible I have tried to maintain compatibility with these libraries the folks at boost for forcing me to <i>think</i>, period. The
and with the POSIX standard - the code however is entirely my own, including following people have all contributed useful comments or fixes:
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian,
about, so if you have any comments or spot any bugs, please get in touch. Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
</P> Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
<P>Useful further information can be found at: Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
</P> Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink,
<P>A short tutorial on regular expressions <A href="http://www.devshed.com/Server_Side/Administration/RegExp/"> Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
can be found here</A>.</P> Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander
<P>The <A href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc Recht, Scott
Specification</A> contains a wealth of useful material, including the VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
regular expression syntax, and specifications for <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html"> Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
&lt;regex.h&gt;</A> and <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html"> the manuals supplied with the Henry Spencer, Perl and GNU regular
&lt;nl_types.h&gt;</A>. expression libraries - wherever possible I have tried to maintain
</P> compatibility with these libraries and with the POSIX standard -
<P>The <A href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern Matching Pointers</A> the code however is entirely my own, including any bugs! I can
site is a "must visit" resource for anyone interested in pattern matching. absolutely guarantee that I will not fix any bugs I don't know
</P> about, so if you have any comments or spot any bugs, please get in
<P><A href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</A>, use a touch.</p>
simplified regular expression syntax to achieve faster search times.
</P> <p>Useful further information can be found at:</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> <p>A short tutorial on regular expressions <a href="http://www.devshed.com/Server_Side/Administration/RegExp/">can be
both have a selection of useful pattern matching papers available from their found here</a>.</p>
respective web sites.
<P> <p>The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
<HR> Specification</a> contains a wealth of useful material, including
<P></P> the regular expression syntax, and specifications for <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
<p>Revised &lt;regex.h&gt;</a> and <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> &lt;nl_types.h&gt;</a>.</p>
11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <p>The <a href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern
</p> Matching Pointers</a> site is a "must visit" resource for anyone
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> interested in pattern matching.</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 <p><a href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</a>,
that the above copyright notice appear in all copies and that both that use a simplified regular expression syntax to achieve faster search
copyright notice and this permission notice appear in supporting documentation. times.</p>
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> <p><a href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</a>
</body> 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 -->11
April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
Maddock</a>&nbsp;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> </html>

View File

@@ -2,60 +2,51 @@
<html> <html>
<head> <head>
<title>Boost.Regex: Examples</title> <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"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <link rel="stylesheet" type="text/css" href="../../../boost.css">
</head> </head>
<body> <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">Examples</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></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 <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 with makefiles for Borland, Microsoft and gcc compilers, otherwise you will
have to create your own makefiles. have to create your own makefiles.</P>
</P> <H5>regress.exe:</H5>
<H5>regress.exe:
</H5>
<P>A regression test application that gives the matching/searching algorithms a <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 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 - 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. if anyone spots anything that isn't being tested I'd be glad to hear about it.</P>
</P>
<P>Files: <A href="../test/regress/parse.cpp">parse.cpp</A>, <A href="../test/regress/regress.cpp"> <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>. regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.</P>
</P> <H5>jgrep.exe</H5>
<H5>jgrep.exe
</H5>
<P>A simple grep implementation, run with no command line options to find out its <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 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 the mapfile class to see an example of a "smart" bidirectional iterator that
can be used with boost.regex or any other STL algorithm. can be used with boost.regex or any other STL algorithm.</P>
</P>
<P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp"> <P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp">
main.cpp</A>. main.cpp</A>.</P>
</P> <H5>timer.exe</H5>
<H5>timer.exe
</H5>
<P>A simple interactive expression matching application, the results of all <P>A simple interactive expression matching application, the results of all
matches are timed, allowing the programmer to optimize their regular matches are timed, allowing the programmer to optimize their regular
expressions where performance is critical. expressions where performance is critical.</P>
</P> <P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.</P>
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.
</P>
<H5>Code snippets</H5> <H5>Code snippets</H5>
<P>The snippets examples contain the code examples used in the documentation:</P> <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>: <P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
@@ -68,8 +59,7 @@
regex_grep example 1: searches a cpp file for class definitions.</P> 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>: <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 regex_grep example 2: searches a cpp file for class definitions, using a global
callback function. callback function.</P>
</P>
<P><A href="../example/snippets/regex_grep_example_3.cpp">regex_grep_example_3.cpp</A>: <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 regex_grep example 2: searches a cpp file for class definitions, using a bound
member function callback.</P> member function callback.</P>
@@ -87,21 +77,23 @@
<P><A href="../example/snippets/regex_split_example_1.cpp">regex_split_example_1.cpp</A>: <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> 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> <P><A href="../example/snippets/regex_split_example_2.cpp">regex_split_example_2.cpp</A>
: regex_split example: spit out linked URL's. : regex_split example: spit out linked URL's.</P>
<P>
<HR>
<P></P> <P></P>
<HR>
<p>Revised <p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->11
11 April 2003 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
</p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software Maddock</a>&nbsp;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 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 that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting documentation. copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software 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> for any purpose. It is provided "as is" without express or implied warranty.</i></p>
</body> </body>
</html> </html>

View File

@@ -28,7 +28,7 @@
regex_merge</A>&nbsp;and by <A href="match_results.html">match_results::format</A>, regex_merge</A>&nbsp;and by <A href="match_results.html">match_results::format</A>,
and are used to transform one string into another. and are used to transform one string into another.
</P> </P>
<P>There are three kind of format string: sed, perl and extended, the extended <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. syntax is a superset of the others so this is covered first.
</P> </P>
<P><B><I>Extended format syntax</I></B> <P><B><I>Extended format syntax</I></B>
@@ -49,7 +49,7 @@
<BR> <BR>
<I>Sub-expression expansions:</I> <I>Sub-expression expansions:</I>
</P> </P>
<P>The following perl like expressions expand to a particular matched <P>The following Perl like expressions expand to a particular matched
sub-expression: sub-expression:
<BR> <BR>
&nbsp; &nbsp;
@@ -158,7 +158,7 @@
<TR> <TR>
<TD vAlign="top" width="8%">&nbsp;</TD> <TD vAlign="top" width="8%">&nbsp;</TD>
<TD vAlign="top" width="40%">\x{}</TD> <TD vAlign="top" width="40%">\x{}</TD>
<TD vAlign="top" width="43%">A possible unicode hexadecimal character - for <TD vAlign="top" width="43%">A possible Unicode hexadecimal character - for
example \x{1A0}</TD> example \x{1A0}</TD>
<TD vAlign="top" width="9%">&nbsp;</TD> <TD vAlign="top" width="9%">&nbsp;</TD>
</TR> </TR>

View File

@@ -24,7 +24,20 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>Todo.</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> <P>
<HR> <HR>
<P></P> <P></P>
@@ -33,7 +46,7 @@
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -134,9 +134,9 @@
directly to your project then define BOOST_REGEX_NO_LIB to disable automatic directly to your project then define BOOST_REGEX_NO_LIB to disable automatic
library selection.</P> library selection.</P>
<P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of <P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of
compiler-optimisation bugs affecting this library, (particularly with VC6 compiler-optimization bugs affecting this library, (particularly with VC6
versions prior to service patch 5) the workaround is to build the library using versions prior to service patch 5) the workaround is to build the library using
/Oityb1 rather than /O2. That is to use all optimisation settings except /Oa. /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 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 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 library), so it's probably worthwhile applying this workaround in normal

View File

@@ -26,16 +26,16 @@
<p></p> <p></p>
<P>Regular expressions are a form of pattern-matching that are often used in text <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> 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 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 extensive use of regular expressions. Traditionally C++ users have been limited
to the POSIX C API's for manipulating regular expressions, and while regex++ 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 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 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 and replace operations (in a manner analogous to either sed or Perl), something
that traditional C libraries can not do.</P> 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 <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 this library; it represents a "machine readable" regular expression, and is
very closely modelled on std::basic_string, think of it as a string plus the 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 actual state-machine required by the regular expression algorithms. Like
std::basic_string there are two typedefs that are almost always the means by std::basic_string there are two typedefs that are almost always the means by
which this class is referenced:</P> which this class is referenced:</P>
@@ -58,18 +58,18 @@
number is in the correct format. To match any digit we could use the regular 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 expression [0-9], however ranges of characters like this are actually locale
dependent. Instead we should use the POSIX standard form [[:digit:]], or the 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 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). 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 That leaves us with the following regular expression to validate credit card
number formats:</P> number formats:</P>
<P>(\d{4}[- ]){3}\d{4}</P> <P>(\d{4}[- ]){3}\d{4}</P>
<P>Here the parenthesis act to group (and mark for future reference) <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 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++ 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 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 generally less useful, unless you already have some basic regular expressions
that you need to reuse.</P> that you need to reuse.</P>
<P>Now lets take that expression and place it in some C++ code to validate the <P>Now let's take that expression and place it in some C++ code to validate the
format of a credit card number:</P> format of a credit card number:</P>
<PRE><B>bool</B> validate_card_format(<B>const</B> std::string s) <PRE><B>bool</B> validate_card_format(<B>const</B> std::string s)
{ {
@@ -83,13 +83,13 @@
examples assume that your compiler supports Koenig lookup, if yours doesn't 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 (for example VC6), then you will have to add some boost:: prefixes to some of
the function calls in the examples.</P> the function calls in the examples.</P>
<P>Those of you who are familiar with credit card processing, will have realised <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, 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 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 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 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 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 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 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 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 with. In regex++ this search and replace operation is performed with the
@@ -152,7 +152,7 @@ std::string human_readable_card_number(<B>const</B> std::string s)
advanced features like multi-character collating elements and equivalence advanced features like multi-character collating elements and equivalence
classes - as well as providing compatibility with other regular expression classes - as well as providing compatibility with other regular expression
libraries including GNU and BSD4 regex packages, and to a more limited extent libraries including GNU and BSD4 regex packages, and to a more limited extent
perl 5. Perl 5.
</P> </P>
<P> <P>
<HR> <HR>
@@ -172,3 +172,4 @@ std::string human_readable_card_number(<B>const</B> std::string s)
</body> </body>
</html> </html>

View File

@@ -50,8 +50,8 @@
LC_TYPE and LC_COLLATE categories. LC_TYPE and LC_COLLATE categories.
</P> </P>
<P>There are three separate localization mechanisms supported by boost.regex:</P> <P>There are three separate localization mechanisms supported by boost.regex:</P>
<P><I>Win32 localization model.</I> <H3>Win32 localization model.
</P> </H3>
<P>This is the default model when the library is compiled under Win32, and is <P>This is the default model when the library is compiled under Win32, and is
encapsulated by the traits class w32_regex_traits. When this model is in effect encapsulated by the traits class w32_regex_traits. When this model is in effect
there is a single global locale as defined by the user's control panel there is a single global locale as defined by the user's control panel
@@ -65,7 +65,7 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the resource <P>which needs to be called with a string identifying the name of the resource
dll, <I>before</I> your code compiles any regular expressions (but not dll, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::w32_regex_traits&lt;char&gt;::set_message_catalogue("mydll.dll"); <P>boost::w32_regex_traits&lt;char&gt;::set_message_catalogue("mydll.dll");
</P> </P>
@@ -77,8 +77,8 @@
under NT, under Windows 9x the library degrades gracefully - characters 0 to under NT, under Windows 9x the library degrades gracefully - characters 0 to
255 are supported, the remainder are treated as "unknown" graphic characters. 255 are supported, the remainder are treated as "unknown" graphic characters.
</P> </P>
<P><I>C localization model.</I> <H3>C localization model.
</P> </H3>
<P>This is the default model when the library is compiled under an operating <P>This is the default model when the library is compiled under an operating
system other than Win32, and is encapsulated by the traits class <I>c_regex_traits</I>, system other than Win32, and is encapsulated by the traits class <I>c_regex_traits</I>,
Win32 users can force this model to take effect by defining the pre-processor Win32 users can force this model to take effect by defining the pre-processor
@@ -92,7 +92,7 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the message <P>which needs to be called with a string identifying the name of the message
catalogue, <I>before</I> your code compiles any regular expressions (but not catalogue, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::c_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue"); <P>boost::c_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue");
</P> </P>
@@ -107,12 +107,12 @@
behave equivalent to most traditional regular expression libraries including behave equivalent to most traditional regular expression libraries including
version 1 of this library. version 1 of this library.
</P> </P>
<P><I><TT>C++ </TT></I><I>localization</I><I><TT> </TT></I><I>model</I><I><TT>.</TT></I> <H3>C++ localization model.
</P> </H3>
<P>This model is only in effect if the library is built with the pre-processor <P>This model is only in effect if the library is built with the pre-processor
symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each
instance of reg_expression&lt;&gt; has its own instance of std::locale, class instance of basic_regex&lt;&gt; has its own instance of std::locale, class
reg_expression&lt;&gt; also has a member function <I>imbue</I> which allows the basic_regex&lt;&gt; also has a member function <I>imbue</I> which allows the
locale for the expression to be set on a per-instance basis. Front end locale for the expression to be set on a per-instance basis. Front end
localization requires a POSIX message catalogue, which will be loaded via the localization requires a POSIX message catalogue, which will be loaded via the
std::messages facet of the expression's locale, the traits class exports the std::messages facet of the expression's locale, the traits class exports the
@@ -122,14 +122,14 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the message <P>which needs to be called with a string identifying the name of the message
catalogue, <I>before</I> your code compiles any regular expressions (but not catalogue, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::cpp_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue"); <P>boost::cpp_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue");
</P> </P>
<P>Note that calling reg_expression&lt;&gt;::imbue will invalidate any expression <P>Note that calling basic_regex&lt;&gt;::imbue will invalidate any expression
currently compiled in that instance of reg_expression&lt;&gt;. This model is currently compiled in that instance of basic_regex&lt;&gt;. This model is the
the one which closest fits the ethos of the C++ standard library, however it is one which closest fits the ethos of the C++ standard library, however it is the
the model which will produce the slowest code, and which is the least well model which will produce the slowest code, and which is the least well
supported by current standard library implementations, for example I have yet supported by current standard library implementations, for example I have yet
to find an implementation of std::locale which supports either message to find an implementation of std::locale which supports either message
catalogues, or locales other than "C" or "POSIX". catalogues, or locales other than "C" or "POSIX".
@@ -141,8 +141,8 @@
&lt;boost/cregex.hpp&gt; in your code. The best way to ensure this is to add &lt;boost/cregex.hpp&gt; in your code. The best way to ensure this is to add
the #define to &lt;boost/regex/user.hpp&gt;. the #define to &lt;boost/regex/user.hpp&gt;.
</P> </P>
<P><I>Providing a message catalogue:</I> <H3>Providing a message catalogue:
</P> </H3>
<P>In order to localize the front end of the library, you need to provide the <P>In order to localize the front end of the library, you need to provide the
library with the appropriate message strings contained either in a resource library with the appropriate message strings contained either in a resource
dll's string table (Win32 model), or a POSIX message catalogue (C or C++ dll's string table (Win32 model), or a POSIX message catalogue (C or C++
@@ -728,12 +728,7 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR> <P>Custom error messages are loaded as follows:&nbsp;
&nbsp;
</P>
<P>Custom error messages are loaded as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -929,12 +924,7 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR> <P>Custom character class names are loaded as followed:&nbsp;
&nbsp;
</P>
<P>Custom character class names are loaded as followed:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -1090,9 +1080,6 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR>
&nbsp;
</P>
<P>Finally, custom collating element names are loaded starting from message id <P>Finally, custom collating element names are loaded starting from message id
400, and terminating when the first load thereafter fails. Each message looks 400, and terminating when the first load thereafter fails. Each message looks
something like: "tagname string" where <I>tagname</I> is the name used inside something like: "tagname string" where <I>tagname</I> is the name used inside

View File

@@ -134,13 +134,7 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
<B> <B>
<P> <P>
Effects:</B> Constructs an object of class match_results. The postconditions Effects:</B> Constructs an object of class match_results. The postconditions
of this function are indicated in Table RE16:</P><I> of this function are indicated in the table:</P>
<H6 align="center">
Table RE16--</I>match_results(const Allocator&amp;)<I> effects</H6>
<P>
<DIV align="center">
<P></P>
</I>
<P align="center"> <P align="center">
<CENTER> <CENTER>
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1"> <TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
@@ -182,7 +176,9 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
</TR> </TR>
</TBODY></TD></TR></TABLE></CENTER> </TBODY></TD></TR></TABLE></CENTER>
<P></P> <P></P>
</DIV><PRE>match_results(const match_results&amp; m);</PRE> <DIV></DIV>
<P>&nbsp;</P>
<PRE>match_results(const match_results&amp; m);</PRE>
<B> <B>
<P> <P>
Effects:</B> Constructs an object of class match_results, as a copy of Effects:</B> Constructs an object of class match_results, as a copy of
@@ -190,26 +186,22 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
<B> <B>
<P> <P>
Effects:</B> Assigns m to *this. The postconditions of this function are Effects:</B> Assigns m to *this. The postconditions of this function are
indicated in Table RE17:</P> indicated in the table:</P>
<H6 align="center">Table RE17--match_results(const Allocator&amp;) effects</H6> <P align="center">
<P> <CENTER>
<DIV align="center"> <TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
<P></P> <TBODY>
<P align="center"> <TR>
<CENTER> <TD vAlign="top" width="50%"><B>
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1"> <P>
<TBODY> Element</B>
<TR>
<TD vAlign="top" width="50%"><B>
<P>
Element</B>
</P>
</TD>
<TD vAlign="top" width="50%"><B>
<P>
Value</B>
</P> </P>
</TD></TR> </TD>
<TD vAlign="top" width="50%"><B>
<P>
Value</B> </P>
</TD>
</TR>
<TR> <TR>
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>empty()</P> <P>empty()</P>
@@ -277,7 +269,7 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
</TR> </TR>
</TBODY></TD></TR></TABLE></CENTER> </TBODY></TD></TR></TABLE></CENTER>
<P></P> <P></P>
</DIV> <DIV></DIV>
<H4>match_results size</H4> <H4>match_results size</H4>
<PRE>size_type size()const;</PRE> <PRE>size_type size()const;</PRE>
<B> <B>

View File

@@ -40,7 +40,7 @@
by regex_match, regex_search or regex_grep):<BR> by regex_match, regex_search or regex_grep):<BR>
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="638" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
<TR> <TR>
<TD vAlign="top" width="20%">&nbsp;</TD> <TD vAlign="top" width="20%">&nbsp;</TD>
<TD vAlign="top" width="20%">Result</TD> <TD vAlign="top" width="20%">Result</TD>
@@ -173,7 +173,7 @@ void search(std::istream&amp; is)
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -158,8 +158,7 @@
<TR> <TR>
<TD width="5%">&nbsp;</TD> <TD width="5%">&nbsp;</TD>
<TD vAlign="top" width="45%">REG_PERL&nbsp;</TD> <TD vAlign="top" width="45%">REG_PERL&nbsp;</TD>
<TD vAlign="top" width="45%">&nbsp;A shortcut for perl-like behavior: REG_EXTENDED <TD vAlign="top" width="45%">Compiles Perl like regular expressions.</TD>
| REG_NOCOLLATE | REG_ESCAPE_IN_LISTS</TD>
<TD width="5%">&nbsp;</TD> <TD width="5%">&nbsp;</TD>
</TR> </TR>
<TR> <TR>
@@ -277,7 +276,7 @@
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -24,9 +24,9 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>The algorithm regex_format is deprecated, new code should use <P>The algorithm regex_format is deprecated; new code should use
match_results::format instead.&nbsp; Existing code will continue to compile, match_results::format instead.&nbsp; Existing code will continue to compile,
the following documentation ius taken from the previous version of boost.regex the following documentation is taken from the previous version of boost.regex
and will not be further updated:</P> and will not be further updated:</P>
<H3>Algorithm regex_format</H3> <H3>Algorithm regex_format</H3>
<H3></H3> <H3></H3>
@@ -63,8 +63,6 @@ std::basic_string&lt;charT&gt; regex_format
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> std::basic_string&lt;charT&gt;&amp; fmt, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> std::basic_string&lt;charT&gt;&amp; fmt,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; match_flag_type flags = 0);</PRE> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; match_flag_type flags = 0);</PRE>
<P>Parameters to the main version of the function are passed as follows: <P>Parameters to the main version of the function are passed as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
@@ -100,8 +98,6 @@ std::basic_string&lt;charT&gt; regex_format
</TABLE> </TABLE>
</P> </P>
<P><A name="format_flags"></A>Format flags are defined as follows: <P><A name="format_flags"></A>Format flags are defined as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0"> <TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0">
@@ -140,9 +136,6 @@ std::basic_string&lt;charT&gt; regex_format
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR>
&nbsp;
</P>
<P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html"> <P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html">
format strings</A> format strings</A>
. .
@@ -154,7 +147,7 @@ std::basic_string&lt;charT&gt; regex_format
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -24,7 +24,7 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>The algorithm regex_grep is deprecated in favour of <A href="regex_iterator.html">regex_iterator</A> <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> which provides a more convenient and standard library friendly interface.</P>
<P>The following documentation is taken unchanged from the previous boost release, <P>The following documentation is taken unchanged from the previous boost release,
and will not be updated in future.</P> and will not be updated in future.</P>
@@ -57,9 +57,7 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> basic_regex&lt;charT, traits, Allocator&gt;&amp; e,&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> basic_regex&lt;charT, traits, Allocator&gt;&amp; e,&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>unsigned</B> flags = match_default);</PRE> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>unsigned</B> flags = match_default);</PRE>
<P>The parameters for the primary version of regex_grep have the following <P>The parameters for the primary version of regex_grep have the following
meanings: meanings:&nbsp;
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -97,8 +95,8 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P>&nbsp;The algorithm finds all of the non-overlapping matches of the expression <P>The algorithm finds all of the non-overlapping matches of the expression e, for
e, for each match it fills a <A href="#reg_match">match_results</A>&lt;iterator, each match it fills a <A href="#reg_match">match_results</A>&lt;iterator,
Allocator&gt; structure, which contains information on what matched, and calls Allocator&gt; structure, which contains information on what matched, and calls
the predicate foo, passing the match_results&lt;iterator, Allocator&gt; as a the predicate foo, passing the match_results&lt;iterator, Allocator&gt; as a
single argument. If the predicate returns true, then the grep operation single argument. If the predicate returns true, then the grep operation
@@ -368,7 +366,7 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -62,7 +62,7 @@ public:
</PRE> </PRE>
<H3><A name="description"></A>Description</H3> <H3><A name="description"></A>Description</H3>
<P>A regex_iterator is constructed from a pair of iterators, and enumerates all <P>A regex_iterator is constructed from a pair of iterators, and enumerates all
occurances of a regular expression within that iterator range.</P> occurrences of a regular expression within that iterator range.</P>
<PRE>regex_iterator();</PRE> <PRE>regex_iterator();</PRE>
<B> <B>
<P> <P>
@@ -71,7 +71,7 @@ public:
match_flag_type m = match_default);</PRE> match_flag_type m = match_default);</PRE>
<B> <B>
<P> <P>
Effects: </B>constructs a regex_iterator that will enumerate all occurances 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 of the expression <EM>re</EM>, within the sequence <EM>[a,b)</EM>, and found
using match flags <EM>m</EM>.&nbsp; The object <EM>re </EM>must exist for the using match flags <EM>m</EM>.&nbsp; The object <EM>re </EM>must exist for the
lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator&amp; that);</PRE> lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator&amp; that);</PRE>
@@ -93,11 +93,10 @@ public:
Effects: </B>returns <CODE>!(*this == that)</CODE>.</P> Effects: </B>returns <CODE>!(*this == that)</CODE>.</P>
<H5>RE.8.1.1 regex_iterator dereference</H5> <H5>RE.8.1.1 regex_iterator dereference</H5>
<PRE>const value_type&amp; operator*();</PRE> <PRE>const value_type&amp; operator*();</PRE>
<B> <P>
<P> <B>Effects:</B> dereferencing a regex_iterator object <EM>it</EM> yields a
Effects: d</B>ereferencing a regex_iterator object <EM>it</EM> yields a const reference to a <A href="match_results.html">match_results</A> object,
const reference to a <A href="match_results.html">match_results</A> object, whose members are set as follows:</P>
whose members are set as follows:</P>
<P> <P>
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1"> <TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
<TBODY> <TBODY>
@@ -196,9 +195,9 @@ public:
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>(*it)[0].matched</P> <P>(*it)[0].matched</P>
</TD> </TD>
<TD vAlign="top" width="50%"><CODE> <TD vAlign="top" width="50%">
<P> <P>
true</CODE> if a full match was found, and <CODE>false</CODE> if it was a <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 partial match (found as a result of the <CODE>match_partial</CODE> flag being
set).</P></TD> set).</P></TD>
</TR> </TR>
@@ -229,7 +228,6 @@ public:
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>For all integers n &lt; (*it).size(), true if sub-expression <I>n</I> participated <P>For all integers n &lt; (*it).size(), true if sub-expression <I>n</I> participated
in the match, false otherwise.</P> in the match, false otherwise.</P>
<P></P>
</TD> </TD>
<TR> <TR>
<TD vAlign="top" width="50%">(*it).position(n)</TD> <TD vAlign="top" width="50%">(*it).position(n)</TD>

View File

@@ -2,76 +2,80 @@
<html> <html>
<head> <head>
<title>Boost.Regex: bad_expression</title> <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"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <link rel="stylesheet" type="text/css" href="../../../boost.css">
</head> </head>
<body> <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 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>
</P>
<HR>
<p></p> <p></p>
<H3>Synopsis</H3> <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<P>#include &lt;<A href="../../boost/regex/pattern_except.hpp">boost/pat_except.hpp</A>&gt; <tr>
</P> <td valign="top" width="300">
<P>The class <CODE>bad_expression</CODE> defines the type of objects thrown as <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 &lt;<a href="../../boost/regex/pattern_except.hpp">boost/pattern_except.hpp</a>&gt;</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 exceptions to report errors during the conversion from a string representing a
regular expression to a finite state machine.&nbsp;&nbsp;</P> regular expression to a finite state machine.&nbsp;&nbsp;</p>
<PRE><B>namespace</B> boost{ <pre>
<b>namespace</b> boost{
<B>class</B> bad_pattern : <B>public</B> std::runtime_error <b>class</b> bad_pattern : <b>public</b> std::runtime_error
{ {
<B>public</B>: <b>public</b>:
&nbsp;&nbsp; <B>explicit</B> bad_pattern(<B>const</B> std::string&amp; s) : std::runtime_error(s){}; <b>explicit</b> bad_pattern(<b>const</b> std::string&amp; s) : std::runtime_error(s){};
}; };
<B>class</B> bad_expression : <B>public</B> bad_pattern <b>class</b> bad_expression : <b>public</b> bad_pattern
{ {
<B>public</B>: <b>public</b>:
&nbsp;&nbsp; bad_expression(<B>const</B> std::string&amp; s) : bad_pattern(s) {} bad_expression(<b>const</b> std::string&amp; s) : bad_pattern(s) {}
}; };
} // namespace boost</PRE> } // namespace boost
<H3>Description</H3> </pre>
<PRE>bad_expression(const string&amp; what_arg); </PRE> <h3>Description</h3>
<P><B>Effects:</B> Constructs an object of class <CODE>bad_expression</CODE>.</P> <pre>
<B> bad_expression(const string&amp; what_arg);
<P> </pre>
Postcondition:</B> <CODE>strcmp(what(), what_arg.c_str()) == 0</CODE>. <p><b>Effects:</b> Constructs an object of class <code>bad_expression</code>.</p>
<P>Footnotes: the class <I>bad_pattern </I>forms the base class for all <b></b>
pattern-matching exceptions, of which <I>bad_expression</I> is one. The choice <p><b>Postcondition:</b> <code>strcmp(what(), what_arg.c_str()) == 0</code>.</p>
of <I>std::runtime_error </I>as the base class for <I>bad_pattern</I> <p>Footnotes: the class <i>bad_pattern</i> forms the base class for all
is moot, depending upon how the library is used exceptions may be either logic pattern-matching exceptions, of which <i>bad_expression</i> is one. The choice
errors (programmer supplied expressions) or run time errors (user supplied of <i>std::runtime_error</i> as the base class for <i>bad_pattern</i> is moot;
expressions). depending upon how the library is used exceptions may be either logic errors
<P> (programmer supplied expressions) or run time errors (user supplied
<HR> expressions).</p>
<P></P> <p></p>
<hr>
<p>Revised <p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
</p> <p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software 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 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 that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting documentation. copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software 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> for any purpose. It is provided "as is" without express or implied warranty.</i></p>
</body> </body>
</html> </html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,163 +1,245 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>
<head> <head>
<title>Boost.Regex: Configuration and setup</title> <title>Boost.Regex: Configuration and setup</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="HTML Tidy, see www.w3.org">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <meta http-equiv="Content-Type" content=
</head> "text/html; charset=iso-8859-1" >
<body> <link rel="stylesheet" type="text/css" href="../../../boost.css">
<P> </head>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> <body>
<TR> <p></p>
<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> <table id="Table1" cellspacing="1" cellpadding="1" width="100%"
</td> border="0">
<TD width="353"> <tr>
<H1 align="center">Boost.Regex</H1> <td valign="top" width="300">
<H2 align="center">Configuration and setup</H2> <h3><a href="../../../index.htm"><img height="86" width="277" alt=
</TD> "C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
<td width="50"> </td>
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> <td width="353">
</td> <h1 align="center">Boost.Regex</h1>
</TR>
</TABLE> <h2 align="center">Configuration and setup</h2>
</P> </td>
<HR> <td width="50">
<h2>Contents</h2> <h3><a href="index.html"><img height="45" width="43" alt=
<dl class="index"> "Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
<dt><a href="#compiler">Compiler setup</a></dt> </td>
<dt><a href="#locale">Locale and traits class selection</a></dt> </tr>
<dt><a href="#linkage">Linkage Options</a></dt> </table>
<dt><a href="#algorithm">Algorithm Selection</a></dt>
<dt><a href="#tuning">Algorithm Tuning</a></dt> <br>
</dl> <br>
<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 <hr>
should already take care of it, if you do have problems (or you are using a <h2>Contents</h2>
particularly obscure compiler or platform) then <A href="../../config/index.html">boost.config</A>&nbsp;has
a&nbsp;<A href="../../config/config.htm#config_script">configure</A> script.</P> <dl class="index">
<H3><A name="locale"></A>Locale and traits class selection.</H3> <dt><a href="#compiler">Compiler setup</a>
<P>The following macros (see <A href="../../../boost/regex/user.hpp">user.hpp</A>)
control how boost.regex interacts with the users locale:</P> <dt><a href="#locale">Locale and traits class selection</a>
<P>
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="1"> <dt><a href="#linkage">Linkage Options</a>
<TR>
<TD width="265">BOOST_REGEX_USE_C_LOCALE</TD> <dt><a href="#algorithm">Algorithm Selection</a>
<TD>Forces boost.regex to use the global C locale in it's traits class support:
this is the default behaviour on non-windows platforms, but MS Windows <dt><a href="#tuning">Algorithm Tuning</a></dt>
platforms normally use the Win32 API for locale support.</TD> </dl>
</TR>
<TR> <h3><a name="compiler"></a>Compiler setup.</h3>
<TD width="265">BOOST_REGEX_USE_CPP_LOCALE</TD>
<TD>Forces boost.regex to use std::locale in it's default traits class, regular <p>You shouldn't need to do anything special to configure
expressions can then be imbued with an instance&nbsp;specific locale.</TD> boost.regex for use with your compiler - the <a href="../../config/index.html">boost.config</a> subsystem should already
</TR> take care of it, if you do have problems (or you are using a
<TR> particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a>&nbsp;has a&nbsp;<a href="../../config/config.htm#config_script">configure</a> script.</p>
<TD width="265">BOOST_REGEX_NO_W32</TD>
<TD>Tells boost.regex not to use any Win32 API's even when available (implies <h3><a name="locale"></a>Locale and traits class selection.</h3>
BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).</TD>
</TR> <p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) control how
</TABLE> boost.regex interacts with the user's locale:</p>
</P>
<H3><A name="linkage"></A>Linkage Options</H3> <p></p>
<P>
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="100%" border="1"> <table id="Table2" cellspacing="1" cellpadding="1" width="100%"
<TR> border="1">
<TD>BOOST_REGEX_STATIC_LINK</TD> <tr>
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it is going <td width="265">BOOST_REGEX_USE_C_LOCALE</td>
to be linked to a static library even when using a dynamic C runtime.</TD> <td>Forces boost.regex to use the global C locale in its traits
</TR> class support: this is the default behavior on non-windows
<TR> platforms, but MS Windows platforms normally use the Win32 API for
<TD>BOOST_REGEX_NO_LIB</TD> locale support.</td>
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it should </tr>
not automatically select the library to link to.</TD>
</TR> <tr>
</TABLE> <td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
</P> <td>Forces boost.regex to use std::locale in it's default traits
<H3><A name="algorithm"></A>Algorithm Selection</H3> class, regular expressions can then be imbued with an
<P> instance&nbsp;specific locale.</td>
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="1"> </tr>
<TR>
<TD width="253">BOOST_REGEX_V3</TD> <tr>
<TD>Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if <td width="265">BOOST_REGEX_NO_W32</td>
you need maximum compatibility with previous behaviour.</TD> <td>Tells boost.regex not to use any Win32 API's even when
</TR> available (implies BOOST_REGEX_USE_C_LOCALE unless
<TR> BOOST_REGEX_USE_CPP_LOCALE is set).</td>
<TD width="253">BOOST_REGEX_RECURSIVE</TD> </tr>
<TD>Tells boost.regex to use a stack-recursive matching algorithm.&nbsp; This is </table>
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 <br>
this is not the case on other platforms.</TD> <br>
</TR>
<TR>
<TD width="253">BOOST_REGEX_NON_RECURSIVE</TD> <h3><a name="linkage"></a>Linkage Options</h3>
<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 <p></p>
pathological the regular expression.&nbsp; This is the default on non-Win32
platforms.</TD> <table id="Table3" cellspacing="1" cellpadding="1" width="100%"
</TR> border="1">
</TABLE> <tr>
</P> <td>BOOST_REGEX_DYN_LINK</td>
<H3><A name="tuning"></A>Algorithm Tuning</H3> <td>For Microsoft and Borland C++ builds, this tells
<P>The following option applies only if BOOST_REGEX_RECURSIVE is set.</P> boost.regex that it should link to the dll build of the boost.regex.&nbsp; By default
<P> boost.regex will link to its static library build, even if the dynamic C runtime library
<TABLE id="Table6" cellSpacing="1" cellPadding="1" width="100%" border="1"> is in use.</td>
<TR> </tr>
<TD>BOOST_REGEX_HAS_MS_STACK_GUARD</TD>
<TD>Tells boost.regex that Microsoft style __try - __except blocks are supported, <tr>
and can be used to safely trap stack overflow.</TD> <td>BOOST_REGEX_NO_LIB</td>
</TR> <td>For Microsoft and Borland C++ builds, this tells boost.regex
</TABLE> that it should not automatically select the library to link
</P> to.</td>
<P>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</P> </tr>
<P> </table>
<TABLE id="Table5" cellSpacing="1" cellPadding="1" width="100%" border="1">
<TR> <br>
<TD>BOOST_REGEX_BLOCKSIZE</TD> <br>
<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.&nbsp; This defaults to 4096 bytes, which is <h3><a name="algorithm"></a>Algorithm Selection</h3>
large enough to match the vast majority of regular expressions&nbsp;without
further allocations, however, you can choose smaller or larger values depending <p></p>
upon your platforms characteristics.</TD>
</TR> <table id="Table4" cellspacing="1" cellpadding="1" width="100%"
<TR> border="1">
<TD>BOOST_REGEX_MAX_BLOCKS</TD> <tr>
<TD>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is <td width="253">BOOST_REGEX_V3</td>
permitted to use.&nbsp; If this value is exceeded then boost.regex will stop <td>Tells boost.regex to use the boost-1.30.0 matching algorithm,
trying to find a match and throw a std::runtime_error.&nbsp; Defaults to 1024, define only if you need maximum compatibility with previous
don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</TD> behavior.</td>
</TR> </tr>
<TR>
<TD>BOOST_REGEX_MAX_CACHE_BLOCKS</TD> <tr>
<TD>Tells boost.regex how many memory blocks to store in it's internal cache - <td width="253">BOOST_REGEX_RECURSIVE</td>
memory blocks are taken from this cache rather than by calling ::operator <td>Tells boost.regex to use a stack-recursive matching
new.&nbsp; Generally speeking this can be an order of magnitude faster than algorithm.&nbsp; This is generally the fastest option (although
calling ::opertator new each time a memory block is required, but has the there is very little in it), but can cause stack overflow in
downside that boost.regex can end up caching a large chunk of memory (by extreme cases, on Win32 this can be handled safely, but this is not
default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).&nbsp; If memory is the case on other platforms.</td>
tight then try defining this to 0 (disables all caching), or if that is too </tr>
slow, then a value of 1 or 2, may be sufficient.&nbsp; On the other hand, on
large multi-processor, multi-threaded systems, you may find that a higher value <tr>
is in order.</TD> <td width="253">BOOST_REGEX_NON_RECURSIVE</td>
</TR> <td>Tells boost.regex to use a non-stack recursive matching
</TABLE> algorithm, this can be slightly slower than the alternative, but is
</P> always safe no matter how pathological the regular
<P> expression.&nbsp; This is the default on non-Win32 platforms.</td>
<HR> </tr>
<P></P> </table>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <br>
11 April 2003 <br>
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <h3><a name="tuning"></a>Algorithm Tuning</h3>
<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 <p>The following option applies only if BOOST_REGEX_RECURSIVE is
that the above copyright notice appear in all copies and that both that set.</p>
copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software <p></p>
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
</body> <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>
<p></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.&nbsp;
This defaults to 4096 bytes, which is large enough to match the
vast majority of regular expressions&nbsp;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.&nbsp; If this value is exceeded then
boost.regex will stop trying to find a match and throw a
std::runtime_error.&nbsp; 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.&nbsp; 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).&nbsp; 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.&nbsp; 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>
<p></p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->11
April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
Maddock</a>&nbsp;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> </html>

View File

@@ -1,86 +1,111 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>
<head> <head>
<title>Boost.Regex: Contacts</title> <title>Boost.Regex: Contacts</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="HTML Tidy, see www.w3.org">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <meta http-equiv="Content-Type" content=
</head> "text/html; charset=iso-8859-1" >
<body> <link rel="stylesheet" type="text/css" href="../../../boost.css">
<P> </head>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> <body>
<TR> <p></p>
<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> <table id="Table1" cellspacing="1" cellpadding="1" width="100%"
</td> border="0">
<TD width="353"> <tr>
<H1 align="center">Boost.Regex</H1> <td valign="top" width="300">
<H2 align="center">Contacts and Acknowledgements</H2> <h3><a href="../../../index.htm"><img height="86" width="277" alt=
</TD> "C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
<td width="50"> </td>
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> <td width="353">
</td> <h1 align="center">Boost.Regex</h1>
</TR>
</TABLE> <h2 align="center">Contacts and Acknowledgements</h2>
</P> </td>
<HR> <td width="50">
<p></p> <h3><a href="index.html"><img height="45" width="43" alt=
<P>The author can be contacted at <A href="mailto:John_Maddock@compuserve.com">John_Maddock@compuserve.com</A>, "Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
the home page for this library is at <A href="http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm"> </td>
http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm</A>, and </tr>
the official boost version can be obtained from <A href="../libraries.htm">www.boost.org/libraries.htm</A>. </table>
</P>
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think <br>
about algorithms and their performance, and to the folks at boost for forcing <br>
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 <hr>
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias <p>The author can be contacted at <a href="mailto:john_maddock@compuserve.com">
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, john_maddock@compuserve.com</a>, the home page for this library is
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens at <a href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm</a>,
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc and the official boost version can be obtained from <a href="../libraries.htm">www.boost.org/libraries.htm</a>.</p>
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 <p>I am indebted to Robert Sedgewick's "Algorithms in C++" for
supplied with the Henry Spencer, Perl and GNU regular expression libraries - forcing me to think about algorithms and their performance, and to
wherever possible I have tried to maintain compatibility with these libraries the folks at boost for forcing me to <i>think</i>, period. The
and with the POSIX standard - the code however is entirely my own, including following people have all contributed useful comments or fixes:
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian,
about, so if you have any comments or spot any bugs, please get in touch. Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
</P> Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
<P>Useful further information can be found at: Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
</P> Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink,
<P>A short tutorial on regular expressions <A href="http://www.devshed.com/Server_Side/Administration/RegExp/"> Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
can be found here</A>.</P> Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander
<P>The <A href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc Recht, Scott
Specification</A> contains a wealth of useful material, including the VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
regular expression syntax, and specifications for <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html"> Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
&lt;regex.h&gt;</A> and <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html"> the manuals supplied with the Henry Spencer, Perl and GNU regular
&lt;nl_types.h&gt;</A>. expression libraries - wherever possible I have tried to maintain
</P> compatibility with these libraries and with the POSIX standard -
<P>The <A href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern Matching Pointers</A> the code however is entirely my own, including any bugs! I can
site is a "must visit" resource for anyone interested in pattern matching. absolutely guarantee that I will not fix any bugs I don't know
</P> about, so if you have any comments or spot any bugs, please get in
<P><A href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</A>, use a touch.</p>
simplified regular expression syntax to achieve faster search times.
</P> <p>Useful further information can be found at:</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> <p>A short tutorial on regular expressions <a href="http://www.devshed.com/Server_Side/Administration/RegExp/">can be
both have a selection of useful pattern matching papers available from their found here</a>.</p>
respective web sites.
<P> <p>The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
<HR> Specification</a> contains a wealth of useful material, including
<P></P> the regular expression syntax, and specifications for <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
<p>Revised &lt;regex.h&gt;</a> and <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> &lt;nl_types.h&gt;</a>.</p>
11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <p>The <a href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern
</p> Matching Pointers</a> site is a "must visit" resource for anyone
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> interested in pattern matching.</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 <p><a href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</a>,
that the above copyright notice appear in all copies and that both that use a simplified regular expression syntax to achieve faster search
copyright notice and this permission notice appear in supporting documentation. times.</p>
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> <p><a href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</a>
</body> 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 -->11
April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
Maddock</a>&nbsp;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> </html>

View File

@@ -2,60 +2,51 @@
<html> <html>
<head> <head>
<title>Boost.Regex: Examples</title> <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"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css"> <link rel="stylesheet" type="text/css" href="../../../boost.css">
</head> </head>
<body> <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">Examples</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></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 <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 with makefiles for Borland, Microsoft and gcc compilers, otherwise you will
have to create your own makefiles. have to create your own makefiles.</P>
</P> <H5>regress.exe:</H5>
<H5>regress.exe:
</H5>
<P>A regression test application that gives the matching/searching algorithms a <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 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 - 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. if anyone spots anything that isn't being tested I'd be glad to hear about it.</P>
</P>
<P>Files: <A href="../test/regress/parse.cpp">parse.cpp</A>, <A href="../test/regress/regress.cpp"> <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>. regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.</P>
</P> <H5>jgrep.exe</H5>
<H5>jgrep.exe
</H5>
<P>A simple grep implementation, run with no command line options to find out its <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 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 the mapfile class to see an example of a "smart" bidirectional iterator that
can be used with boost.regex or any other STL algorithm. can be used with boost.regex or any other STL algorithm.</P>
</P>
<P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp"> <P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp">
main.cpp</A>. main.cpp</A>.</P>
</P> <H5>timer.exe</H5>
<H5>timer.exe
</H5>
<P>A simple interactive expression matching application, the results of all <P>A simple interactive expression matching application, the results of all
matches are timed, allowing the programmer to optimize their regular matches are timed, allowing the programmer to optimize their regular
expressions where performance is critical. expressions where performance is critical.</P>
</P> <P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.</P>
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.
</P>
<H5>Code snippets</H5> <H5>Code snippets</H5>
<P>The snippets examples contain the code examples used in the documentation:</P> <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>: <P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
@@ -68,8 +59,7 @@
regex_grep example 1: searches a cpp file for class definitions.</P> 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>: <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 regex_grep example 2: searches a cpp file for class definitions, using a global
callback function. callback function.</P>
</P>
<P><A href="../example/snippets/regex_grep_example_3.cpp">regex_grep_example_3.cpp</A>: <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 regex_grep example 2: searches a cpp file for class definitions, using a bound
member function callback.</P> member function callback.</P>
@@ -87,21 +77,23 @@
<P><A href="../example/snippets/regex_split_example_1.cpp">regex_split_example_1.cpp</A>: <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> 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> <P><A href="../example/snippets/regex_split_example_2.cpp">regex_split_example_2.cpp</A>
: regex_split example: spit out linked URL's. : regex_split example: spit out linked URL's.</P>
<P>
<HR>
<P></P> <P></P>
<HR>
<p>Revised <p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->11
11 April 2003 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
</p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software Maddock</a>&nbsp;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 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 that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting documentation. copyright notice and this permission notice appear in supporting documentation.
Dr John Maddock makes no representations about the suitability of this software 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> for any purpose. It is provided "as is" without express or implied warranty.</i></p>
</body> </body>
</html> </html>

View File

@@ -28,7 +28,7 @@
regex_merge</A>&nbsp;and by <A href="match_results.html">match_results::format</A>, regex_merge</A>&nbsp;and by <A href="match_results.html">match_results::format</A>,
and are used to transform one string into another. and are used to transform one string into another.
</P> </P>
<P>There are three kind of format string: sed, perl and extended, the extended <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. syntax is a superset of the others so this is covered first.
</P> </P>
<P><B><I>Extended format syntax</I></B> <P><B><I>Extended format syntax</I></B>
@@ -49,7 +49,7 @@
<BR> <BR>
<I>Sub-expression expansions:</I> <I>Sub-expression expansions:</I>
</P> </P>
<P>The following perl like expressions expand to a particular matched <P>The following Perl like expressions expand to a particular matched
sub-expression: sub-expression:
<BR> <BR>
&nbsp; &nbsp;
@@ -158,7 +158,7 @@
<TR> <TR>
<TD vAlign="top" width="8%">&nbsp;</TD> <TD vAlign="top" width="8%">&nbsp;</TD>
<TD vAlign="top" width="40%">\x{}</TD> <TD vAlign="top" width="40%">\x{}</TD>
<TD vAlign="top" width="43%">A possible unicode hexadecimal character - for <TD vAlign="top" width="43%">A possible Unicode hexadecimal character - for
example \x{1A0}</TD> example \x{1A0}</TD>
<TD vAlign="top" width="9%">&nbsp;</TD> <TD vAlign="top" width="9%">&nbsp;</TD>
</TR> </TR>

View File

@@ -24,7 +24,20 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>Todo.</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> <P>
<HR> <HR>
<P></P> <P></P>
@@ -33,7 +46,7 @@
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -134,9 +134,9 @@
directly to your project then define BOOST_REGEX_NO_LIB to disable automatic directly to your project then define BOOST_REGEX_NO_LIB to disable automatic
library selection.</P> library selection.</P>
<P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of <P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of
compiler-optimisation bugs affecting this library, (particularly with VC6 compiler-optimization bugs affecting this library, (particularly with VC6
versions prior to service patch 5) the workaround is to build the library using versions prior to service patch 5) the workaround is to build the library using
/Oityb1 rather than /O2. That is to use all optimisation settings except /Oa. /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 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 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 library), so it's probably worthwhile applying this workaround in normal

View File

@@ -26,16 +26,16 @@
<p></p> <p></p>
<P>Regular expressions are a form of pattern-matching that are often used in text <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> 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 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 extensive use of regular expressions. Traditionally C++ users have been limited
to the POSIX C API's for manipulating regular expressions, and while regex++ 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 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 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 and replace operations (in a manner analogous to either sed or Perl), something
that traditional C libraries can not do.</P> 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 <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 this library; it represents a "machine readable" regular expression, and is
very closely modelled on std::basic_string, think of it as a string plus the 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 actual state-machine required by the regular expression algorithms. Like
std::basic_string there are two typedefs that are almost always the means by std::basic_string there are two typedefs that are almost always the means by
which this class is referenced:</P> which this class is referenced:</P>
@@ -58,18 +58,18 @@
number is in the correct format. To match any digit we could use the regular 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 expression [0-9], however ranges of characters like this are actually locale
dependent. Instead we should use the POSIX standard form [[:digit:]], or the 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 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). 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 That leaves us with the following regular expression to validate credit card
number formats:</P> number formats:</P>
<P>(\d{4}[- ]){3}\d{4}</P> <P>(\d{4}[- ]){3}\d{4}</P>
<P>Here the parenthesis act to group (and mark for future reference) <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 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++ 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 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 generally less useful, unless you already have some basic regular expressions
that you need to reuse.</P> that you need to reuse.</P>
<P>Now lets take that expression and place it in some C++ code to validate the <P>Now let's take that expression and place it in some C++ code to validate the
format of a credit card number:</P> format of a credit card number:</P>
<PRE><B>bool</B> validate_card_format(<B>const</B> std::string s) <PRE><B>bool</B> validate_card_format(<B>const</B> std::string s)
{ {
@@ -83,13 +83,13 @@
examples assume that your compiler supports Koenig lookup, if yours doesn't 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 (for example VC6), then you will have to add some boost:: prefixes to some of
the function calls in the examples.</P> the function calls in the examples.</P>
<P>Those of you who are familiar with credit card processing, will have realised <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, 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 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 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 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 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 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 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 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 with. In regex++ this search and replace operation is performed with the
@@ -152,7 +152,7 @@ std::string human_readable_card_number(<B>const</B> std::string s)
advanced features like multi-character collating elements and equivalence advanced features like multi-character collating elements and equivalence
classes - as well as providing compatibility with other regular expression classes - as well as providing compatibility with other regular expression
libraries including GNU and BSD4 regex packages, and to a more limited extent libraries including GNU and BSD4 regex packages, and to a more limited extent
perl 5. Perl 5.
</P> </P>
<P> <P>
<HR> <HR>
@@ -172,3 +172,4 @@ std::string human_readable_card_number(<B>const</B> std::string s)
</body> </body>
</html> </html>

View File

@@ -50,8 +50,8 @@
LC_TYPE and LC_COLLATE categories. LC_TYPE and LC_COLLATE categories.
</P> </P>
<P>There are three separate localization mechanisms supported by boost.regex:</P> <P>There are three separate localization mechanisms supported by boost.regex:</P>
<P><I>Win32 localization model.</I> <H3>Win32 localization model.
</P> </H3>
<P>This is the default model when the library is compiled under Win32, and is <P>This is the default model when the library is compiled under Win32, and is
encapsulated by the traits class w32_regex_traits. When this model is in effect encapsulated by the traits class w32_regex_traits. When this model is in effect
there is a single global locale as defined by the user's control panel there is a single global locale as defined by the user's control panel
@@ -65,7 +65,7 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the resource <P>which needs to be called with a string identifying the name of the resource
dll, <I>before</I> your code compiles any regular expressions (but not dll, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::w32_regex_traits&lt;char&gt;::set_message_catalogue("mydll.dll"); <P>boost::w32_regex_traits&lt;char&gt;::set_message_catalogue("mydll.dll");
</P> </P>
@@ -77,8 +77,8 @@
under NT, under Windows 9x the library degrades gracefully - characters 0 to under NT, under Windows 9x the library degrades gracefully - characters 0 to
255 are supported, the remainder are treated as "unknown" graphic characters. 255 are supported, the remainder are treated as "unknown" graphic characters.
</P> </P>
<P><I>C localization model.</I> <H3>C localization model.
</P> </H3>
<P>This is the default model when the library is compiled under an operating <P>This is the default model when the library is compiled under an operating
system other than Win32, and is encapsulated by the traits class <I>c_regex_traits</I>, system other than Win32, and is encapsulated by the traits class <I>c_regex_traits</I>,
Win32 users can force this model to take effect by defining the pre-processor Win32 users can force this model to take effect by defining the pre-processor
@@ -92,7 +92,7 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the message <P>which needs to be called with a string identifying the name of the message
catalogue, <I>before</I> your code compiles any regular expressions (but not catalogue, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::c_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue"); <P>boost::c_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue");
</P> </P>
@@ -107,12 +107,12 @@
behave equivalent to most traditional regular expression libraries including behave equivalent to most traditional regular expression libraries including
version 1 of this library. version 1 of this library.
</P> </P>
<P><I><TT>C++ </TT></I><I>localization</I><I><TT> </TT></I><I>model</I><I><TT>.</TT></I> <H3>C++ localization model.
</P> </H3>
<P>This model is only in effect if the library is built with the pre-processor <P>This model is only in effect if the library is built with the pre-processor
symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each
instance of reg_expression&lt;&gt; has its own instance of std::locale, class instance of basic_regex&lt;&gt; has its own instance of std::locale, class
reg_expression&lt;&gt; also has a member function <I>imbue</I> which allows the basic_regex&lt;&gt; also has a member function <I>imbue</I> which allows the
locale for the expression to be set on a per-instance basis. Front end locale for the expression to be set on a per-instance basis. Front end
localization requires a POSIX message catalogue, which will be loaded via the localization requires a POSIX message catalogue, which will be loaded via the
std::messages facet of the expression's locale, the traits class exports the std::messages facet of the expression's locale, the traits class exports the
@@ -122,14 +122,14 @@
</P> </P>
<P>which needs to be called with a string identifying the name of the message <P>which needs to be called with a string identifying the name of the message
catalogue, <I>before</I> your code compiles any regular expressions (but not catalogue, <I>before</I> your code compiles any regular expressions (but not
necessarily before you construct any <I>reg_expression</I> instances): necessarily before you construct any <I>basic_regex</I> instances):
</P> </P>
<P>boost::cpp_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue"); <P>boost::cpp_regex_traits&lt;char&gt;::set_message_catalogue("mycatalogue");
</P> </P>
<P>Note that calling reg_expression&lt;&gt;::imbue will invalidate any expression <P>Note that calling basic_regex&lt;&gt;::imbue will invalidate any expression
currently compiled in that instance of reg_expression&lt;&gt;. This model is currently compiled in that instance of basic_regex&lt;&gt;. This model is the
the one which closest fits the ethos of the C++ standard library, however it is one which closest fits the ethos of the C++ standard library, however it is the
the model which will produce the slowest code, and which is the least well model which will produce the slowest code, and which is the least well
supported by current standard library implementations, for example I have yet supported by current standard library implementations, for example I have yet
to find an implementation of std::locale which supports either message to find an implementation of std::locale which supports either message
catalogues, or locales other than "C" or "POSIX". catalogues, or locales other than "C" or "POSIX".
@@ -141,8 +141,8 @@
&lt;boost/cregex.hpp&gt; in your code. The best way to ensure this is to add &lt;boost/cregex.hpp&gt; in your code. The best way to ensure this is to add
the #define to &lt;boost/regex/user.hpp&gt;. the #define to &lt;boost/regex/user.hpp&gt;.
</P> </P>
<P><I>Providing a message catalogue:</I> <H3>Providing a message catalogue:
</P> </H3>
<P>In order to localize the front end of the library, you need to provide the <P>In order to localize the front end of the library, you need to provide the
library with the appropriate message strings contained either in a resource library with the appropriate message strings contained either in a resource
dll's string table (Win32 model), or a POSIX message catalogue (C or C++ dll's string table (Win32 model), or a POSIX message catalogue (C or C++
@@ -728,12 +728,7 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR> <P>Custom error messages are loaded as follows:&nbsp;
&nbsp;
</P>
<P>Custom error messages are loaded as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -929,12 +924,7 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR> <P>Custom character class names are loaded as followed:&nbsp;
&nbsp;
</P>
<P>Custom character class names are loaded as followed:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -1090,9 +1080,6 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR>
&nbsp;
</P>
<P>Finally, custom collating element names are loaded starting from message id <P>Finally, custom collating element names are loaded starting from message id
400, and terminating when the first load thereafter fails. Each message looks 400, and terminating when the first load thereafter fails. Each message looks
something like: "tagname string" where <I>tagname</I> is the name used inside something like: "tagname string" where <I>tagname</I> is the name used inside

View File

@@ -134,13 +134,7 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
<B> <B>
<P> <P>
Effects:</B> Constructs an object of class match_results. The postconditions Effects:</B> Constructs an object of class match_results. The postconditions
of this function are indicated in Table RE16:</P><I> of this function are indicated in the table:</P>
<H6 align="center">
Table RE16--</I>match_results(const Allocator&amp;)<I> effects</H6>
<P>
<DIV align="center">
<P></P>
</I>
<P align="center"> <P align="center">
<CENTER> <CENTER>
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1"> <TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
@@ -182,7 +176,9 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
</TR> </TR>
</TBODY></TD></TR></TABLE></CENTER> </TBODY></TD></TR></TABLE></CENTER>
<P></P> <P></P>
</DIV><PRE>match_results(const match_results&amp; m);</PRE> <DIV></DIV>
<P>&nbsp;</P>
<PRE>match_results(const match_results&amp; m);</PRE>
<B> <B>
<P> <P>
Effects:</B> Constructs an object of class match_results, as a copy of Effects:</B> Constructs an object of class match_results, as a copy of
@@ -190,26 +186,22 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
<B> <B>
<P> <P>
Effects:</B> Assigns m to *this. The postconditions of this function are Effects:</B> Assigns m to *this. The postconditions of this function are
indicated in Table RE17:</P> indicated in the table:</P>
<H6 align="center">Table RE17--match_results(const Allocator&amp;) effects</H6> <P align="center">
<P> <CENTER>
<DIV align="center"> <TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
<P></P> <TBODY>
<P align="center"> <TR>
<CENTER> <TD vAlign="top" width="50%"><B>
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1"> <P>
<TBODY> Element</B>
<TR>
<TD vAlign="top" width="50%"><B>
<P>
Element</B>
</P>
</TD>
<TD vAlign="top" width="50%"><B>
<P>
Value</B>
</P> </P>
</TD></TR> </TD>
<TD vAlign="top" width="50%"><B>
<P>
Value</B> </P>
</TD>
</TR>
<TR> <TR>
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>empty()</P> <P>empty()</P>
@@ -277,7 +269,7 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
</TR> </TR>
</TBODY></TD></TR></TABLE></CENTER> </TBODY></TD></TR></TABLE></CENTER>
<P></P> <P></P>
</DIV> <DIV></DIV>
<H4>match_results size</H4> <H4>match_results size</H4>
<PRE>size_type size()const;</PRE> <PRE>size_type size()const;</PRE>
<B> <B>

View File

@@ -40,7 +40,7 @@
by regex_match, regex_search or regex_grep):<BR> by regex_match, regex_search or regex_grep):<BR>
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="638" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
<TR> <TR>
<TD vAlign="top" width="20%">&nbsp;</TD> <TD vAlign="top" width="20%">&nbsp;</TD>
<TD vAlign="top" width="20%">Result</TD> <TD vAlign="top" width="20%">Result</TD>
@@ -173,7 +173,7 @@ void search(std::istream&amp; is)
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -158,8 +158,7 @@
<TR> <TR>
<TD width="5%">&nbsp;</TD> <TD width="5%">&nbsp;</TD>
<TD vAlign="top" width="45%">REG_PERL&nbsp;</TD> <TD vAlign="top" width="45%">REG_PERL&nbsp;</TD>
<TD vAlign="top" width="45%">&nbsp;A shortcut for perl-like behavior: REG_EXTENDED <TD vAlign="top" width="45%">Compiles Perl like regular expressions.</TD>
| REG_NOCOLLATE | REG_ESCAPE_IN_LISTS</TD>
<TD width="5%">&nbsp;</TD> <TD width="5%">&nbsp;</TD>
</TR> </TR>
<TR> <TR>
@@ -277,7 +276,7 @@
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -24,9 +24,9 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>The algorithm regex_format is deprecated, new code should use <P>The algorithm regex_format is deprecated; new code should use
match_results::format instead.&nbsp; Existing code will continue to compile, match_results::format instead.&nbsp; Existing code will continue to compile,
the following documentation ius taken from the previous version of boost.regex the following documentation is taken from the previous version of boost.regex
and will not be further updated:</P> and will not be further updated:</P>
<H3>Algorithm regex_format</H3> <H3>Algorithm regex_format</H3>
<H3></H3> <H3></H3>
@@ -63,8 +63,6 @@ std::basic_string&lt;charT&gt; regex_format
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> std::basic_string&lt;charT&gt;&amp; fmt, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> std::basic_string&lt;charT&gt;&amp; fmt,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; match_flag_type flags = 0);</PRE> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; match_flag_type flags = 0);</PRE>
<P>Parameters to the main version of the function are passed as follows: <P>Parameters to the main version of the function are passed as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
@@ -100,8 +98,6 @@ std::basic_string&lt;charT&gt; regex_format
</TABLE> </TABLE>
</P> </P>
<P><A name="format_flags"></A>Format flags are defined as follows: <P><A name="format_flags"></A>Format flags are defined as follows:
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0"> <TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0">
@@ -140,9 +136,6 @@ std::basic_string&lt;charT&gt; regex_format
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P><BR>
&nbsp;
</P>
<P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html"> <P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html">
format strings</A> format strings</A>
. .
@@ -154,7 +147,7 @@ std::basic_string&lt;charT&gt; regex_format
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -24,7 +24,7 @@
</P> </P>
<HR> <HR>
<p></p> <p></p>
<P>The algorithm regex_grep is deprecated in favour of <A href="regex_iterator.html">regex_iterator</A> <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> which provides a more convenient and standard library friendly interface.</P>
<P>The following documentation is taken unchanged from the previous boost release, <P>The following documentation is taken unchanged from the previous boost release,
and will not be updated in future.</P> and will not be updated in future.</P>
@@ -57,9 +57,7 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> basic_regex&lt;charT, traits, Allocator&gt;&amp; e,&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>const</B> basic_regex&lt;charT, traits, Allocator&gt;&amp; e,&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>unsigned</B> flags = match_default);</PRE> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <B>unsigned</B> flags = match_default);</PRE>
<P>The parameters for the primary version of regex_grep have the following <P>The parameters for the primary version of regex_grep have the following
meanings: meanings:&nbsp;
<BR>
&nbsp;
</P> </P>
<P> <P>
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0"> <TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0">
@@ -97,8 +95,8 @@
</TR> </TR>
</TABLE> </TABLE>
</P> </P>
<P>&nbsp;The algorithm finds all of the non-overlapping matches of the expression <P>The algorithm finds all of the non-overlapping matches of the expression e, for
e, for each match it fills a <A href="#reg_match">match_results</A>&lt;iterator, each match it fills a <A href="#reg_match">match_results</A>&lt;iterator,
Allocator&gt; structure, which contains information on what matched, and calls Allocator&gt; structure, which contains information on what matched, and calls
the predicate foo, passing the match_results&lt;iterator, Allocator&gt; as a the predicate foo, passing the match_results&lt;iterator, Allocator&gt; as a
single argument. If the predicate returns true, then the grep operation single argument. If the predicate returns true, then the grep operation
@@ -368,7 +366,7 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
11 April 2003 11 April 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --> <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p> </p>
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P> <P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a>&nbsp;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 <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 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 that the above copyright notice appear in all copies and that both that

View File

@@ -62,7 +62,7 @@ public:
</PRE> </PRE>
<H3><A name="description"></A>Description</H3> <H3><A name="description"></A>Description</H3>
<P>A regex_iterator is constructed from a pair of iterators, and enumerates all <P>A regex_iterator is constructed from a pair of iterators, and enumerates all
occurances of a regular expression within that iterator range.</P> occurrences of a regular expression within that iterator range.</P>
<PRE>regex_iterator();</PRE> <PRE>regex_iterator();</PRE>
<B> <B>
<P> <P>
@@ -71,7 +71,7 @@ public:
match_flag_type m = match_default);</PRE> match_flag_type m = match_default);</PRE>
<B> <B>
<P> <P>
Effects: </B>constructs a regex_iterator that will enumerate all occurances 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 of the expression <EM>re</EM>, within the sequence <EM>[a,b)</EM>, and found
using match flags <EM>m</EM>.&nbsp; The object <EM>re </EM>must exist for the using match flags <EM>m</EM>.&nbsp; The object <EM>re </EM>must exist for the
lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator&amp; that);</PRE> lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator&amp; that);</PRE>
@@ -93,11 +93,10 @@ public:
Effects: </B>returns <CODE>!(*this == that)</CODE>.</P> Effects: </B>returns <CODE>!(*this == that)</CODE>.</P>
<H5>RE.8.1.1 regex_iterator dereference</H5> <H5>RE.8.1.1 regex_iterator dereference</H5>
<PRE>const value_type&amp; operator*();</PRE> <PRE>const value_type&amp; operator*();</PRE>
<B> <P>
<P> <B>Effects:</B> dereferencing a regex_iterator object <EM>it</EM> yields a
Effects: d</B>ereferencing a regex_iterator object <EM>it</EM> yields a const reference to a <A href="match_results.html">match_results</A> object,
const reference to a <A href="match_results.html">match_results</A> object, whose members are set as follows:</P>
whose members are set as follows:</P>
<P> <P>
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1"> <TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
<TBODY> <TBODY>
@@ -196,9 +195,9 @@ public:
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>(*it)[0].matched</P> <P>(*it)[0].matched</P>
</TD> </TD>
<TD vAlign="top" width="50%"><CODE> <TD vAlign="top" width="50%">
<P> <P>
true</CODE> if a full match was found, and <CODE>false</CODE> if it was a <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 partial match (found as a result of the <CODE>match_partial</CODE> flag being
set).</P></TD> set).</P></TD>
</TR> </TR>
@@ -229,7 +228,6 @@ public:
<TD vAlign="top" width="50%"> <TD vAlign="top" width="50%">
<P>For all integers n &lt; (*it).size(), true if sub-expression <I>n</I> participated <P>For all integers n &lt; (*it).size(), true if sub-expression <I>n</I> participated
in the match, false otherwise.</P> in the match, false otherwise.</P>
<P></P>
</TD> </TD>
<TR> <TR>
<TD vAlign="top" width="50%">(*it).position(n)</TD> <TD vAlign="top" width="50%">(*it).position(n)</TD>

View File

@@ -41,9 +41,11 @@ test-suite regex-examples :
[ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ] [ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
[ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ] [ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
[ regex-test-run snippets/regex_split_example_1.cpp : -auto ] [ regex-test-run snippets/regex_split_example_1.cpp : -auto ]
[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/index.htm ] [ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/index.html ]
; ;

View File

@@ -10,6 +10,10 @@
#include <boost/version.hpp> #include <boost/version.hpp>
#include "regex_comparison.hpp" #include "regex_comparison.hpp"
#ifdef BOOST_HAS_PCRE
#include "pcre.h" // for pcre version number
#endif
// //
// globals: // globals:
// //
@@ -32,6 +36,20 @@ std::string html_out_file;
std::string html_contents; std::string html_contents;
std::list<results> result_list; std::list<results> result_list;
// the following let us compute averages:
double greta_total = 0;
double safe_greta_total = 0;
double boost_total = 0;
double locale_boost_total = 0;
double posix_total = 0;
double pcre_total = 0;
unsigned greta_test_count = 0;
unsigned safe_greta_test_count = 0;
unsigned boost_test_count = 0;
unsigned locale_boost_test_count = 0;
unsigned posix_test_count = 0;
unsigned pcre_test_count = 0;
int handle_argument(const std::string& what) int handle_argument(const std::string& what)
{ {
if(what == "-b") if(what == "-b")
@@ -196,7 +214,7 @@ std::string html_quote(const std::string& in)
{ {
static const boost::regex e("(<)|(>)|(&)|(\")"); static const boost::regex e("(<)|(>)|(&)|(\")");
static const std::string format("(?1&lt;)(?2&gt;)(?3&amp;)(?4&quot;)"); static const std::string format("(?1&lt;)(?2&gt;)(?3&amp;)(?4&quot;)");
return regex_replace(in, e, format); return regex_replace(in, e, format, boost::match_default | boost::format_all);
} }
void output_html_results(bool show_description, const std::string& tagname) void output_html_results(bool show_description, const std::string& tagname)
@@ -244,21 +262,63 @@ void output_html_results(bool show_description, const std::string& tagname)
os << "<td>" << html_quote(first->description) << "</td>"; os << "<td>" << html_quote(first->description) << "</td>";
#if defined(BOOST_HAS_GRETA) #if defined(BOOST_HAS_GRETA)
if(time_greta == true) if(time_greta == true)
{
print_result(os, first->greta_time, first->factor); print_result(os, first->greta_time, first->factor);
if(first->greta_time > 0)
{
greta_total += first->greta_time / first->factor;
++greta_test_count;
}
}
if(time_safe_greta == true) if(time_safe_greta == true)
{
print_result(os, first->safe_greta_time, first->factor); print_result(os, first->safe_greta_time, first->factor);
if(first->safe_greta_time > 0)
{
safe_greta_total += first->safe_greta_time / first->factor;
++safe_greta_test_count;
}
}
#endif #endif
#if defined(BOOST_HAS_POSIX) #if defined(BOOST_HAS_POSIX)
if(time_boost == true) if(time_boost == true)
{
print_result(os, first->boost_time, first->factor); print_result(os, first->boost_time, first->factor);
if(first->boost_time > 0)
{
boost_total += first->boost_time / first->factor;
++boost_test_count;
}
}
if(time_localised_boost == true) if(time_localised_boost == true)
{
print_result(os, first->localised_boost_time, first->factor); print_result(os, first->localised_boost_time, first->factor);
if(first->localised_boost_time > 0)
{
locale_boost_total += first->localised_boost_time / first->factor;
++locale_boost_test_count;
}
}
#endif #endif
if(time_posix == true) if(time_posix == true)
{
print_result(os, first->posix_time, first->factor); print_result(os, first->posix_time, first->factor);
if(first->posix_time > 0)
{
posix_total += first->posix_time / first->factor;
++posix_test_count;
}
}
#if defined(BOOST_HAS_PCRE) #if defined(BOOST_HAS_PCRE)
if(time_pcre == true) if(time_pcre == true)
{
print_result(os, first->pcre_time, first->factor); print_result(os, first->pcre_time, first->factor);
if(first->pcre_time > 0)
{
pcre_total += first->pcre_time / first->factor;
++pcre_test_count;
}
}
#endif #endif
os << "</tr>\n"; os << "</tr>\n";
++first; ++first;
@@ -280,6 +340,81 @@ void output_html_results(bool show_description, const std::string& tagname)
} }
} }
std::string get_boost_version()
{
std::stringstream os;
os << (BOOST_VERSION / 100000) << '.' << ((BOOST_VERSION / 100) % 1000) << '.' << (BOOST_VERSION % 100);
return os.str();
}
std::string get_averages_table()
{
std::stringstream os;
//
// start by outputting the table header:
//
os << "<table border=\"1\" cellspacing=\"1\">\n";
os << "<tr>";
#if defined(BOOST_HAS_GRETA)
if(time_greta == true)
{
os << "<td><strong>GRETA</strong></td>";
}
if(time_safe_greta == true)
{
os << "<td><strong>GRETA<BR>(non-recursive mode)</strong></td>";
}
#endif
if(time_boost == true)
{
os << "<td><strong>Boost</strong></td>";
}
if(time_localised_boost == true)
{
os << "<td><strong>Boost + C++ locale</strong></td>";
}
#if defined(BOOST_HAS_POSIX)
if(time_posix == true)
{
os << "<td><strong>POSIX</strong></td>";
}
#endif
#ifdef BOOST_HAS_PCRE
if(time_pcre == true)
{
os << "<td><strong>PCRE</strong></td>";
}
#endif
os << "</tr>\n";
//
// Now enumerate through all averages:
//
os << "<tr>";
#if defined(BOOST_HAS_GRETA)
if(time_greta == true)
os << "<td>" << (greta_total / greta_test_count) << "</td>\n";
if(time_safe_greta == true)
os << "<td>" << (safe_greta_total / safe_greta_test_count) << "</td>\n";
#endif
#if defined(BOOST_HAS_POSIX)
if(time_boost == true)
os << "<td>" << (boost_total / boost_test_count) << "</td>\n";
if(time_localised_boost == true)
os << "<td>" << (locale_boost_total / locale_boost_test_count) << "</td>\n";
#endif
if(time_posix == true)
os << "<td>" << (posix_total / posix_test_count) << "</td>\n";
#if defined(BOOST_HAS_PCRE)
if(time_pcre == true)
os << "<td>" << (pcre_total / pcre_test_count) << "</td>\n";
#endif
os << "</tr>\n";
os << "</table>\n";
return os.str();
}
void output_final_html() void output_final_html()
{ {
if(html_out_file.size()) if(html_out_file.size())
@@ -306,7 +441,7 @@ void output_final_html()
pos = html_contents.find("%boost%"); pos = html_contents.find("%boost%");
if(pos != std::string::npos) if(pos != std::string::npos)
{ {
html_contents.replace(pos, 7, BOOST_STRINGIZE(BOOST_VERSION)); html_contents.replace(pos, 7, get_boost_version());
} }
pos = html_contents.find("%pcre%"); pos = html_contents.find("%pcre%");
if(pos != std::string::npos) if(pos != std::string::npos)
@@ -317,7 +452,12 @@ void output_final_html()
html_contents.replace(pos, 6, "N/A"); html_contents.replace(pos, 6, "N/A");
#endif #endif
} }
// pos = html_contents.find("%averages%");
if(pos != std::string::npos)
{
html_contents.replace(pos, 10, get_averages_table());
}
//
// now right the output to file: // now right the output to file:
// //
std::ofstream os(html_out_file.c_str()); std::ofstream os(html_out_file.c_str());

View File

@@ -8,13 +8,14 @@
</head> </head>
<body bgcolor="#ffffff" link="#0000ff" vlink="#800080"> <body bgcolor="#ffffff" link="#0000ff" vlink="#800080">
<h2>Regular Expression Performance Comparison</h2> <h2>Regular Expression Performance Comparison</h2>
<p>The Boost and GRETA regular expression libraries have slightly different <p>
interfaces, and it has been suggested that GRETA's interface allows for a more The following tables provide comparisons between the following regular
efficient implementation. The following tables provide comparisons between:</p> expression libraries:</p>
<p><a href="http://research.microsoft.com/projects/greta">GRETA</a>.</p> <p><a href="http://research.microsoft.com/projects/greta">GRETA</a>.</p>
<p><a href="http://www.boost.org/">The Boost regex library</a>.</p> <p><a href="http://www.boost.org/">The Boost regex library</a>.</p>
<p><a href="http://arglist.com/regex/">Henry Spencer's regular expression library</a> <p><a href="http://arglist.com/regex/">Henry Spencer's regular expression library</a>
- this is provided for comparison as a typical non-backtracking implementation.</p> - this is provided for comparison as a typical non-backtracking implementation.</p>
<P>Philip Hazel's <A href="http://www.pcre.org">PCRE</A> library.</P>
<H3>Details</H3> <H3>Details</H3>
<P>Machine: Intel Pentium 4 2.8GHz PC.</P> <P>Machine: Intel Pentium 4 2.8GHz PC.</P>
<P>Compiler: %compiler%.</P> <P>Compiler: %compiler%.</P>
@@ -30,6 +31,11 @@
performance of these libraries can be expected on other machines - as memory performance of these libraries can be expected on other machines - as memory
access and processor caching effects can be quite large for most finite state access and processor caching effects can be quite large for most finite state
machine algorithms.</P> machine algorithms.</P>
<H3>Averages</H3>
<P>The following are the average relative scores for all the tests: the perfect
regular expression library&nbsp;would score 1, in practice anything less than 2
is pretty good.</P>
<P>%averages%</P>
<h3>Comparison 1: Long Search</h3> <h3>Comparison 1: Long Search</h3>
<p>For each of the following regular expressions the time taken to find all <p>For each of the following regular expressions the time taken to find all
occurrences of the expression within a long English language text was measured occurrences of the expression within a long English language text was measured

View File

@@ -254,8 +254,9 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
// STLport users as well (gcc3.1+STLport5), so enable the // STLport users as well (gcc3.1+STLport5), so enable the
// workaround for all STLport users... // workaround for all STLport users...
// //
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) #if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && !defined(BOOST_MSVC)
using namespace std; using namespace std;
using stlport::isspace;
# define BOOST_REGEX_STD # define BOOST_REGEX_STD
#else #else
# define BOOST_REGEX_STD std:: # define BOOST_REGEX_STD std::

View File

@@ -58,6 +58,18 @@ test-suite regex
c_compiler_checks/wide_posix_api_check.cpp c_compiler_checks/wide_posix_api_check.cpp
] ]
[ regex-test bad_expression_test
: <template>test # sources
pathology/bad_expression_test.cpp
<lib>../../test/build/boost_test_exec_monitor
]
[ regex-test recursion_test
: <template>test # sources
pathology/recursion_test.cpp
<lib>../../test/build/boost_test_exec_monitor
]
; ;

View File

@@ -42,7 +42,7 @@ int test_main( int argc, char* argv[] )
BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e1), std::runtime_error); BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e1), std::runtime_error);
BOOST_CHECK(boost::regex_match(good_text, what, e1)); BOOST_CHECK(boost::regex_match(good_text, what, e1));
boost::regex e2("abc|[[:space:]]+xyz"); boost::regex e2("abc|[[:space:]]+(xyz)?[[:space:]]+xyz");
BOOST_CHECK(boost::regex_search(good_text, what, e2)); BOOST_CHECK(boost::regex_search(good_text, what, e2));
BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error); BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error);