forked from boostorg/regex
Final tweaks, almost ready for release...
[SVN r18400]
This commit is contained in:
@ -2,76 +2,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: bad_expression</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<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>
|
||||
<H3>Synopsis</H3>
|
||||
<P>#include <<A href="../../boost/regex/pattern_except.hpp">boost/pat_except.hpp</A>>
|
||||
</P>
|
||||
<P>The class <CODE>bad_expression</CODE> defines the type of objects thrown as
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">class bad_expression</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>Synopsis</h3>
|
||||
<p>#include <<a href="../../boost/regex/pattern_except.hpp">boost/pattern_except.hpp</a>></p>
|
||||
<p>The class <code>bad_expression</code> defines the type of objects thrown as
|
||||
exceptions to report errors during the conversion from a string representing a
|
||||
regular expression to a finite state machine. </P>
|
||||
<PRE><B>namespace</B> boost{
|
||||
regular expression to a finite state machine. </p>
|
||||
<pre>
|
||||
<b>namespace</b> boost{
|
||||
|
||||
<B>class</B> bad_pattern : <B>public</B> std::runtime_error
|
||||
<b>class</b> bad_pattern : <b>public</b> std::runtime_error
|
||||
{
|
||||
<B>public</B>:
|
||||
<B>explicit</B> bad_pattern(<B>const</B> std::string& s) : std::runtime_error(s){};
|
||||
<b>public</b>:
|
||||
<b>explicit</b> bad_pattern(<b>const</b> std::string& s) : std::runtime_error(s){};
|
||||
};
|
||||
|
||||
<B>class</B> bad_expression : <B>public</B> bad_pattern
|
||||
<b>class</b> bad_expression : <b>public</b> bad_pattern
|
||||
{
|
||||
<B>public</B>:
|
||||
bad_expression(<B>const</B> std::string& s) : bad_pattern(s) {}
|
||||
<b>public</b>:
|
||||
bad_expression(<b>const</b> std::string& s) : bad_pattern(s) {}
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost</PRE>
|
||||
<H3>Description</H3>
|
||||
<PRE>bad_expression(const string& what_arg); </PRE>
|
||||
<P><B>Effects:</B> Constructs an object of class <CODE>bad_expression</CODE>.</P>
|
||||
<B>
|
||||
<P>
|
||||
Postcondition:</B> <CODE>strcmp(what(), what_arg.c_str()) == 0</CODE>.
|
||||
<P>Footnotes: the class <I>bad_pattern </I>forms the base class for all
|
||||
pattern-matching exceptions, of which <I>bad_expression</I> is one. The choice
|
||||
of <I>std::runtime_error </I>as the base class for <I>bad_pattern</I>
|
||||
is moot, depending upon how the library is used exceptions may be either logic
|
||||
errors (programmer supplied expressions) or run time errors (user supplied
|
||||
expressions).
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
} // namespace boost
|
||||
</pre>
|
||||
<h3>Description</h3>
|
||||
<pre>
|
||||
bad_expression(const string& what_arg);
|
||||
</pre>
|
||||
<p><b>Effects:</b> Constructs an object of class <code>bad_expression</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Postcondition:</b> <code>strcmp(what(), what_arg.c_str()) == 0</code>.</p>
|
||||
<p>Footnotes: the class <i>bad_pattern</i> forms the base class for all
|
||||
pattern-matching exceptions, of which <i>bad_expression</i> is one. The choice
|
||||
of <i>std::runtime_error</i> as the base class for <i>bad_pattern</i> is moot;
|
||||
depending upon how the library is used exceptions may be either logic errors
|
||||
(programmer supplied expressions) or run time errors (user supplied
|
||||
expressions).</p>
|
||||
<p></p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
<!--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> 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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,163 +1,245 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Configuration and setup</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Configuration and setup</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<h2>Contents</h2>
|
||||
<dl class="index">
|
||||
<dt><a href="#compiler">Compiler setup</a></dt>
|
||||
<dt><a href="#locale">Locale and traits class selection</a></dt>
|
||||
<dt><a href="#linkage">Linkage Options</a></dt>
|
||||
<dt><a href="#algorithm">Algorithm Selection</a></dt>
|
||||
<dt><a href="#tuning">Algorithm Tuning</a></dt>
|
||||
</dl>
|
||||
<H3><A name="compiler"></A>Compiler setup.</H3>
|
||||
<P>You shouldn't need to do anything special to configure boost.regex for use with
|
||||
your compiler - the <A href="../../config/index.html">boost.config</A> subsystem
|
||||
should already take care of it, if you do have problems (or you are using a
|
||||
particularly obscure compiler or platform) then <A href="../../config/index.html">boost.config</A> has
|
||||
a <A href="../../config/config.htm#config_script">configure</A> script.</P>
|
||||
<H3><A name="locale"></A>Locale and traits class selection.</H3>
|
||||
<P>The following macros (see <A href="../../../boost/regex/user.hpp">user.hpp</A>)
|
||||
control how boost.regex interacts with the users locale:</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_USE_C_LOCALE</TD>
|
||||
<TD>Forces boost.regex to use the global C locale in it's traits class support:
|
||||
this is the default behaviour on non-windows platforms, but MS Windows
|
||||
platforms normally use the Win32 API for locale support.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_USE_CPP_LOCALE</TD>
|
||||
<TD>Forces boost.regex to use std::locale in it's default traits class, regular
|
||||
expressions can then be imbued with an instance specific locale.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_NO_W32</TD>
|
||||
<TD>Tells boost.regex not to use any Win32 API's even when available (implies
|
||||
BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="linkage"></A>Linkage Options</H3>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_STATIC_LINK</TD>
|
||||
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it is going
|
||||
to be linked to a static library even when using a dynamic C runtime.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_NO_LIB</TD>
|
||||
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it should
|
||||
not automatically select the library to link to.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="algorithm"></A>Algorithm Selection</H3>
|
||||
<P>
|
||||
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_V3</TD>
|
||||
<TD>Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if
|
||||
you need maximum compatibility with previous behaviour.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_RECURSIVE</TD>
|
||||
<TD>Tells boost.regex to use a stack-recursive matching algorithm. This is
|
||||
generally the fastest option (although there is very little in it), but can
|
||||
cause stack overflow in extreme cases, on Win32 this can be handled safely, but
|
||||
this is not the case on other platforms.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_NON_RECURSIVE</TD>
|
||||
<TD>Tells boost.regex to use a non-stack recursive matching algorithm, this can be
|
||||
slightly slower than the alternative, but is always safe no matter how
|
||||
pathological the regular expression. This is the default on non-Win32
|
||||
platforms.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="tuning"></A>Algorithm Tuning</H3>
|
||||
<P>The following option applies only if BOOST_REGEX_RECURSIVE is set.</P>
|
||||
<P>
|
||||
<TABLE id="Table6" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_HAS_MS_STACK_GUARD</TD>
|
||||
<TD>Tells boost.regex that Microsoft style __try - __except blocks are supported,
|
||||
and can be used to safely trap stack overflow.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</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. This defaults to 4096 bytes, which is
|
||||
large enough to match the vast majority of regular expressions without
|
||||
further allocations, however, you can choose smaller or larger values depending
|
||||
upon your platforms characteristics.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_MAX_BLOCKS</TD>
|
||||
<TD>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is
|
||||
permitted to use. If this value is exceeded then boost.regex will stop
|
||||
trying to find a match and throw a std::runtime_error. Defaults to 1024,
|
||||
don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_MAX_CACHE_BLOCKS</TD>
|
||||
<TD>Tells boost.regex how many memory blocks to store in it's internal cache -
|
||||
memory blocks are taken from this cache rather than by calling ::operator
|
||||
new. Generally speeking this can be an order of magnitude faster than
|
||||
calling ::opertator new each time a memory block is required, but has the
|
||||
downside that boost.regex can end up caching a large chunk of memory (by
|
||||
default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If memory is
|
||||
tight then try defining this to 0 (disables all caching), or if that is too
|
||||
slow, then a value of 1 or 2, may be sufficient. On the other hand, on
|
||||
large multi-processor, multi-threaded systems, you may find that a higher value
|
||||
is in order.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<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> 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>
|
||||
<head>
|
||||
<title>Boost.Regex: Configuration and setup</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1" >
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Configuration and setup</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2>Contents</h2>
|
||||
|
||||
<dl class="index">
|
||||
<dt><a href="#compiler">Compiler setup</a>
|
||||
|
||||
<dt><a href="#locale">Locale and traits class selection</a>
|
||||
|
||||
<dt><a href="#linkage">Linkage Options</a>
|
||||
|
||||
<dt><a href="#algorithm">Algorithm Selection</a>
|
||||
|
||||
<dt><a href="#tuning">Algorithm Tuning</a></dt>
|
||||
</dl>
|
||||
|
||||
<h3><a name="compiler"></a>Compiler setup.</h3>
|
||||
|
||||
<p>You shouldn't need to do anything special to configure
|
||||
boost.regex for use with your compiler - the <a href="../../config/index.html">boost.config</a> subsystem should already
|
||||
take care of it, if you do have problems (or you are using a
|
||||
particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a> has a <a href="../../config/config.htm#config_script">configure</a> script.</p>
|
||||
|
||||
<h3><a name="locale"></a>Locale and traits class selection.</h3>
|
||||
|
||||
<p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) control how
|
||||
boost.regex interacts with the user's locale:</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_C_LOCALE</td>
|
||||
<td>Forces boost.regex to use the global C locale in its traits
|
||||
class support: this is the default behavior on non-windows
|
||||
platforms, but MS Windows platforms normally use the Win32 API for
|
||||
locale support.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
|
||||
<td>Forces boost.regex to use std::locale in it's default traits
|
||||
class, regular expressions can then be imbued with an
|
||||
instance specific locale.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_NO_W32</td>
|
||||
<td>Tells boost.regex not to use any Win32 API's even when
|
||||
available (implies BOOST_REGEX_USE_C_LOCALE unless
|
||||
BOOST_REGEX_USE_CPP_LOCALE is set).</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="linkage"></a>Linkage Options</h3>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table3" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_DYN_LINK</td>
|
||||
<td>For Microsoft and Borland C++ builds, this tells
|
||||
boost.regex that it should link to the dll build of the boost.regex. By default
|
||||
boost.regex will link to its static library build, even if the dynamic C runtime library
|
||||
is in use.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_NO_LIB</td>
|
||||
<td>For Microsoft and Borland C++ builds, this tells boost.regex
|
||||
that it should not automatically select the library to link
|
||||
to.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="algorithm"></a>Algorithm Selection</h3>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table4" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_V3</td>
|
||||
<td>Tells boost.regex to use the boost-1.30.0 matching algorithm,
|
||||
define only if you need maximum compatibility with previous
|
||||
behavior.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_RECURSIVE</td>
|
||||
<td>Tells boost.regex to use a stack-recursive matching
|
||||
algorithm. This is generally the fastest option (although
|
||||
there is very little in it), but can cause stack overflow in
|
||||
extreme cases, on Win32 this can be handled safely, but this is not
|
||||
the case on other platforms.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_NON_RECURSIVE</td>
|
||||
<td>Tells boost.regex to use a non-stack recursive matching
|
||||
algorithm, this can be slightly slower than the alternative, but is
|
||||
always safe no matter how pathological the regular
|
||||
expression. This is the default on non-Win32 platforms.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="tuning"></a>Algorithm Tuning</h3>
|
||||
|
||||
<p>The following option applies only if BOOST_REGEX_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table6" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_HAS_MS_STACK_GUARD</td>
|
||||
<td>Tells boost.regex that Microsoft style __try - __except blocks
|
||||
are supported, and can be used to safely trap stack overflow.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>The following options apply only if BOOST_REGEX_NON_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<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.
|
||||
This defaults to 4096 bytes, which is large enough to match the
|
||||
vast majority of regular expressions without further
|
||||
allocations, however, you can choose smaller or larger values
|
||||
depending upon your platforms characteristics.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_BLOCKS</td>
|
||||
<td>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE
|
||||
it is permitted to use. If this value is exceeded then
|
||||
boost.regex will stop trying to find a match and throw a
|
||||
std::runtime_error. Defaults to 1024, don't forget to tweek
|
||||
this value if you alter BOOST_REGEX_BLOCKSIZE by much.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_CACHE_BLOCKS</td>
|
||||
<td>Tells boost.regex how many memory blocks to store in it's
|
||||
internal cache - memory blocks are taken from this cache rather
|
||||
than by calling ::operator new. Generally speeking this can
|
||||
be an order of magnitude faster than calling ::opertator new each
|
||||
time a memory block is required, but has the downside that
|
||||
boost.regex can end up caching a large chunk of memory (by default
|
||||
up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If
|
||||
memory is tight then try defining this to 0 (disables all caching),
|
||||
or if that is too slow, then a value of 1 or 2, may be
|
||||
sufficient. On the other hand, on large multi-processor,
|
||||
multi-threaded systems, you may find that a higher value is in
|
||||
order.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<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> 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>
|
||||
|
@ -1,86 +1,111 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Contacts</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Contacts and Acknowledgements</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>The author can be contacted at <A href="mailto:John_Maddock@compuserve.com">John_Maddock@compuserve.com</A>,
|
||||
the home page for this library is at <A href="http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm">
|
||||
http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm</A>, and
|
||||
the official boost version can be obtained from <A href="../libraries.htm">www.boost.org/libraries.htm</A>.
|
||||
</P>
|
||||
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think
|
||||
about algorithms and their performance, and to the folks at boost for forcing
|
||||
me to <I>think</I>, period. The following people have all contributed useful
|
||||
comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
|
||||
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias
|
||||
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones,
|
||||
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens
|
||||
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
|
||||
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc
|
||||
Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals
|
||||
supplied with the Henry Spencer, Perl and GNU regular expression libraries -
|
||||
wherever possible I have tried to maintain compatibility with these libraries
|
||||
and with the POSIX standard - the code however is entirely my own, including
|
||||
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know
|
||||
about, so if you have any comments or spot any bugs, please get in touch.
|
||||
</P>
|
||||
<P>Useful further information can be found at:
|
||||
</P>
|
||||
<P>A short tutorial on regular expressions <A href="http://www.devshed.com/Server_Side/Administration/RegExp/">
|
||||
can be found here</A>.</P>
|
||||
<P>The <A href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
|
||||
Specification</A> contains a wealth of useful material, including the
|
||||
regular expression syntax, and specifications for <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
|
||||
<regex.h></A> and <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
|
||||
<nl_types.h></A>.
|
||||
</P>
|
||||
<P>The <A href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern Matching Pointers</A>
|
||||
site is a "must visit" resource for anyone interested in pattern matching.
|
||||
</P>
|
||||
<P><A href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</A>, use a
|
||||
simplified regular expression syntax to achieve faster search times.
|
||||
</P>
|
||||
<P><A href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</A> and <A href="http://www.dcc.uchile.cl/~rbaeza/">
|
||||
Ricardo Baeza-Yates</A>
|
||||
both have a selection of useful pattern matching papers available from their
|
||||
respective web sites.
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<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> 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>
|
||||
<head>
|
||||
<title>Boost.Regex: Contacts</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1" >
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Contacts and Acknowledgements</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>The author can be contacted at <a href="mailto:john_maddock@compuserve.com">
|
||||
john_maddock@compuserve.com</a>, the home page for this library is
|
||||
at <a href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
|
||||
http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm</a>,
|
||||
and the official boost version can be obtained from <a href="../libraries.htm">www.boost.org/libraries.htm</a>.</p>
|
||||
|
||||
<p>I am indebted to Robert Sedgewick's "Algorithms in C++" for
|
||||
forcing me to think about algorithms and their performance, and to
|
||||
the folks at boost for forcing me to <i>think</i>, period. The
|
||||
following people have all contributed useful comments or fixes:
|
||||
Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian,
|
||||
Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
|
||||
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
|
||||
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink,
|
||||
Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
|
||||
Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander
|
||||
Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc Recht, Scott
|
||||
VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
|
||||
the manuals supplied with the Henry Spencer, Perl and GNU regular
|
||||
expression libraries - wherever possible I have tried to maintain
|
||||
compatibility with these libraries and with the POSIX standard -
|
||||
the code however is entirely my own, including any bugs! I can
|
||||
absolutely guarantee that I will not fix any bugs I don't know
|
||||
about, so if you have any comments or spot any bugs, please get in
|
||||
touch.</p>
|
||||
|
||||
<p>Useful further information can be found at:</p>
|
||||
|
||||
<p>A short tutorial on regular expressions <a href="http://www.devshed.com/Server_Side/Administration/RegExp/">can be
|
||||
found here</a>.</p>
|
||||
|
||||
<p>The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
|
||||
Specification</a> contains a wealth of useful material, including
|
||||
the regular expression syntax, and specifications for <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
|
||||
<regex.h></a> and <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
|
||||
<nl_types.h></a>.</p>
|
||||
|
||||
<p>The <a href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern
|
||||
Matching Pointers</a> site is a "must visit" resource for anyone
|
||||
interested in pattern matching.</p>
|
||||
|
||||
<p><a href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</a>,
|
||||
use a simplified regular expression syntax to achieve faster search
|
||||
times.</p>
|
||||
|
||||
<p><a href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</a>
|
||||
and <a href="http://www.dcc.uchile.cl/~rbaeza/">Ricardo
|
||||
Baeza-Yates</a> both have a selection of useful pattern matching
|
||||
papers available from their respective web sites.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->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> 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>
|
||||
|
@ -2,60 +2,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Examples</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<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>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">Examples</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<BR>
|
||||
<BR>
|
||||
<HR>
|
||||
<P>There are three demo applications that ship with this library, they all come
|
||||
with makefiles for Borland, Microsoft and gcc compilers, otherwise you will
|
||||
have to create your own makefiles.
|
||||
</P>
|
||||
<H5>regress.exe:
|
||||
</H5>
|
||||
have to create your own makefiles.</P>
|
||||
<H5>regress.exe:</H5>
|
||||
<P>A regression test application that gives the matching/searching algorithms a
|
||||
full workout. The presence of this program is your guarantee that the library
|
||||
will behave as claimed - at least as far as those items tested are concerned -
|
||||
if anyone spots anything that isn't being tested I'd be glad to hear about it.
|
||||
</P>
|
||||
if anyone spots anything that isn't being tested I'd be glad to hear about it.</P>
|
||||
<P>Files: <A href="../test/regress/parse.cpp">parse.cpp</A>, <A href="../test/regress/regress.cpp">
|
||||
regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.
|
||||
</P>
|
||||
<H5>jgrep.exe
|
||||
</H5>
|
||||
regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.</P>
|
||||
<H5>jgrep.exe</H5>
|
||||
<P>A simple grep implementation, run with no command line options to find out its
|
||||
usage. Look at <A href="../src/fileiter.cpp">fileiter.cpp</A>/fileiter.hpp and
|
||||
the mapfile class to see an example of a "smart" bidirectional iterator that
|
||||
can be used with boost.regex or any other STL algorithm.
|
||||
</P>
|
||||
can be used with boost.regex or any other STL algorithm.</P>
|
||||
<P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp">
|
||||
main.cpp</A>.
|
||||
</P>
|
||||
<H5>timer.exe
|
||||
</H5>
|
||||
main.cpp</A>.</P>
|
||||
<H5>timer.exe</H5>
|
||||
<P>A simple interactive expression matching application, the results of all
|
||||
matches are timed, allowing the programmer to optimize their regular
|
||||
expressions where performance is critical.
|
||||
</P>
|
||||
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.
|
||||
</P>
|
||||
expressions where performance is critical.</P>
|
||||
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.</P>
|
||||
<H5>Code snippets</H5>
|
||||
<P>The snippets examples contain the code examples used in the documentation:</P>
|
||||
<P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
|
||||
@ -68,8 +59,7 @@
|
||||
regex_grep example 1: searches a cpp file for class definitions.</P>
|
||||
<P><A href="../example/snippets/regex_grep_example_2.cpp">regex_grep_example_2.cpp</A>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a global
|
||||
callback function.
|
||||
</P>
|
||||
callback function.</P>
|
||||
<P><A href="../example/snippets/regex_grep_example_3.cpp">regex_grep_example_3.cpp</A>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a bound
|
||||
member function callback.</P>
|
||||
@ -87,21 +77,23 @@
|
||||
<P><A href="../example/snippets/regex_split_example_1.cpp">regex_split_example_1.cpp</A>:
|
||||
regex_split example: split a string into tokens.</P>
|
||||
<P><A href="../example/snippets/regex_split_example_2.cpp">regex_split_example_2.cpp</A>
|
||||
: regex_split example: spit out linked URL's.
|
||||
<P>
|
||||
<HR>
|
||||
: regex_split example: spit out linked URL's.</P>
|
||||
<P></P>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
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> 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
|
||||
<!--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> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,7 +28,7 @@
|
||||
regex_merge</A> and by <A href="match_results.html">match_results::format</A>,
|
||||
and are used to transform one string into another.
|
||||
</P>
|
||||
<P>There are three kind of format string: sed, perl and extended, the extended
|
||||
<P>There are three kind of format string: sed, Perl and extended, the extended
|
||||
syntax is a superset of the others so this is covered first.
|
||||
</P>
|
||||
<P><B><I>Extended format syntax</I></B>
|
||||
@ -49,7 +49,7 @@
|
||||
<BR>
|
||||
<I>Sub-expression expansions:</I>
|
||||
</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:
|
||||
<BR>
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
<TR>
|
||||
<TD vAlign="top" width="8%"> </TD>
|
||||
<TD vAlign="top" width="40%">\x{}</TD>
|
||||
<TD vAlign="top" width="43%">A possible unicode hexadecimal character - for
|
||||
<TD vAlign="top" width="43%">A possible Unicode hexadecimal character - for
|
||||
example \x{1A0}</TD>
|
||||
<TD vAlign="top" width="9%"> </TD>
|
||||
</TR>
|
||||
|
@ -24,7 +24,20 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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>
|
||||
<HR>
|
||||
<P></P>
|
||||
@ -33,7 +46,7 @@
|
||||
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> 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> 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
|
||||
|
@ -134,9 +134,9 @@
|
||||
directly to your project then define BOOST_REGEX_NO_LIB to disable automatic
|
||||
library selection.</P>
|
||||
<P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of
|
||||
compiler-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
|
||||
/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
|
||||
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
|
||||
|
@ -26,16 +26,16 @@
|
||||
<p></p>
|
||||
<P>Regular expressions are a form of pattern-matching that are often used in text
|
||||
processing; many users will be familiar with the Unix utilities <I>grep</I>, <I>sed</I>
|
||||
and <I>awk</I>, and the programming language <I>perl</I>, each of which make
|
||||
and <I>awk</I>, and the programming language <I>Perl</I>, each of which make
|
||||
extensive use of regular expressions. Traditionally C++ users have been limited
|
||||
to the POSIX C API's for manipulating regular expressions, and while regex++
|
||||
does provide these API's, they do not represent the best way to use the
|
||||
library. For example regex++ can cope with wide character strings, or search
|
||||
and replace operations (in a manner analogous to either sed or perl), something
|
||||
and replace operations (in a manner analogous to either sed or Perl), something
|
||||
that traditional C libraries can not do.</P>
|
||||
<P>The class <A href="basic_regex.html">boost::basic_regex</A> is the key class in
|
||||
this library; it represents a "machine readable" regular expression, and is
|
||||
very closely 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
|
||||
std::basic_string there are two typedefs that are almost always the means by
|
||||
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
|
||||
expression [0-9], however ranges of characters like this are actually locale
|
||||
dependent. Instead we should use the POSIX standard form [[:digit:]], or the
|
||||
regex++ and perl shorthand for this \d (note that many older libraries tended
|
||||
regex++ and Perl shorthand for this \d (note that many older libraries tended
|
||||
to be hard-coded to the C-locale, consequently this was not an issue for them).
|
||||
That leaves us with the following regular expression to validate credit card
|
||||
number formats:</P>
|
||||
<P>(\d{4}[- ]){3}\d{4}</P>
|
||||
<P>Here the parenthesis act to group (and mark for future reference)
|
||||
sub-expressions, and the {4} means "repeat exactly 4 times". This is an example
|
||||
of the extended regular expression syntax used by perl, awk and egrep. Regex++
|
||||
of the extended regular expression syntax used by Perl, awk and egrep. Regex++
|
||||
also supports the older "basic" syntax used by sed and grep, but this is
|
||||
generally less useful, unless you already have some basic regular expressions
|
||||
that you need to reuse.</P>
|
||||
<P>Now 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>
|
||||
<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
|
||||
(for example VC6), then you will have to add some boost:: prefixes to some of
|
||||
the function calls in the examples.</P>
|
||||
<P>Those of you who are familiar with credit card processing, will have 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,
|
||||
it does not represent the format required by online credit card systems; these
|
||||
require the number as a string of 16 (or possibly 15) digits, without any
|
||||
intervening spaces. What we need is a means to convert easily between the two
|
||||
formats, and this is where search and replace comes in. Those who are familiar
|
||||
with the utilities <I>sed</I> and <I>perl</I> will already be ahead here; we
|
||||
with the utilities <I>sed</I> and <I>Perl</I> will already be ahead here; we
|
||||
need two strings - one a regular expression - the other a "<A href="format_syntax.html">format
|
||||
string</A>" that provides a description of the text to replace the match
|
||||
with. In regex++ this search and replace operation is performed with the
|
||||
@ -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
|
||||
classes - as well as providing compatibility with other regular expression
|
||||
libraries including GNU and BSD4 regex packages, and to a more limited extent
|
||||
perl 5.
|
||||
Perl 5.
|
||||
</P>
|
||||
<P>
|
||||
<HR>
|
||||
@ -172,3 +172,4 @@ std::string human_readable_card_number(<B>const</B> std::string s)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
@ -50,8 +50,8 @@
|
||||
LC_TYPE and LC_COLLATE categories.
|
||||
</P>
|
||||
<P>There are three separate localization mechanisms supported by boost.regex:</P>
|
||||
<P><I>Win32 localization model.</I>
|
||||
</P>
|
||||
<H3>Win32 localization model.
|
||||
</H3>
|
||||
<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
|
||||
there is a single global locale as defined by the user's control panel
|
||||
@ -65,7 +65,7 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::w32_regex_traits<char>::set_message_catalogue("mydll.dll");
|
||||
</P>
|
||||
@ -77,8 +77,8 @@
|
||||
under NT, under Windows 9x the library degrades gracefully - characters 0 to
|
||||
255 are supported, the remainder are treated as "unknown" graphic characters.
|
||||
</P>
|
||||
<P><I>C localization model.</I>
|
||||
</P>
|
||||
<H3>C localization model.
|
||||
</H3>
|
||||
<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>,
|
||||
Win32 users can force this model to take effect by defining the pre-processor
|
||||
@ -92,7 +92,7 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::c_regex_traits<char>::set_message_catalogue("mycatalogue");
|
||||
</P>
|
||||
@ -107,12 +107,12 @@
|
||||
behave equivalent to most traditional regular expression libraries including
|
||||
version 1 of this library.
|
||||
</P>
|
||||
<P><I><TT>C++ </TT></I><I>localization</I><I><TT> </TT></I><I>model</I><I><TT>.</TT></I>
|
||||
</P>
|
||||
<H3>C++ localization model.
|
||||
</H3>
|
||||
<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
|
||||
instance of reg_expression<> has its own instance of std::locale, class
|
||||
reg_expression<> also has a member function <I>imbue</I> which allows the
|
||||
instance of basic_regex<> has its own instance of std::locale, class
|
||||
basic_regex<> 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
|
||||
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
|
||||
@ -122,14 +122,14 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::cpp_regex_traits<char>::set_message_catalogue("mycatalogue");
|
||||
</P>
|
||||
<P>Note that calling reg_expression<>::imbue will invalidate any expression
|
||||
currently compiled in that instance of reg_expression<>. This model is
|
||||
the one which closest fits the ethos of the C++ standard library, however it is
|
||||
the model which will produce the slowest code, and which is the least well
|
||||
<P>Note that calling basic_regex<>::imbue will invalidate any expression
|
||||
currently compiled in that instance of basic_regex<>. This model is the
|
||||
one which closest fits the ethos of the C++ standard library, however it is the
|
||||
model which will produce the slowest code, and which is the least well
|
||||
supported by current standard library implementations, for example I have yet
|
||||
to find an implementation of std::locale which supports either message
|
||||
catalogues, or locales other than "C" or "POSIX".
|
||||
@ -141,8 +141,8 @@
|
||||
<boost/cregex.hpp> in your code. The best way to ensure this is to add
|
||||
the #define to <boost/regex/user.hpp>.
|
||||
</P>
|
||||
<P><I>Providing a message catalogue:</I>
|
||||
</P>
|
||||
<H3>Providing a message catalogue:
|
||||
</H3>
|
||||
<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
|
||||
dll's string table (Win32 model), or a POSIX message catalogue (C or C++
|
||||
@ -728,12 +728,7 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Custom error messages are loaded as follows:
|
||||
<BR>
|
||||
|
||||
<P>Custom error messages are loaded as follows:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -929,12 +924,7 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Custom character class names are loaded as followed:
|
||||
<BR>
|
||||
|
||||
<P>Custom character class names are loaded as followed:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -1090,9 +1080,6 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Finally, custom collating element names are loaded starting from message id
|
||||
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
|
||||
|
@ -134,13 +134,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Constructs an object of class match_results. The postconditions
|
||||
of this function are indicated in Table RE16:</P><I>
|
||||
<H6 align="center">
|
||||
Table RE16--</I>match_results(const Allocator&)<I> effects</H6>
|
||||
<P>
|
||||
<DIV align="center">
|
||||
<P></P>
|
||||
</I>
|
||||
of this function are indicated in the table:</P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
@ -182,7 +176,9 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
</TR>
|
||||
</TBODY></TD></TR></TABLE></CENTER>
|
||||
<P></P>
|
||||
</DIV><PRE>match_results(const match_results& m);</PRE>
|
||||
<DIV></DIV>
|
||||
<P> </P>
|
||||
<PRE>match_results(const match_results& m);</PRE>
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Constructs an object of class match_results, as a copy of
|
||||
@ -190,26 +186,22 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Assigns m to *this. The postconditions of this function are
|
||||
indicated in Table RE17:</P>
|
||||
<H6 align="center">Table RE17--match_results(const Allocator&) effects</H6>
|
||||
<P>
|
||||
<DIV align="center">
|
||||
<P></P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Element</B>
|
||||
</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Value</B>
|
||||
indicated in the table:</P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Element</B>
|
||||
</P>
|
||||
</TD></TR>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Value</B> </P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>empty()</P>
|
||||
@ -277,7 +269,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
</TR>
|
||||
</TBODY></TD></TR></TABLE></CENTER>
|
||||
<P></P>
|
||||
</DIV>
|
||||
<DIV></DIV>
|
||||
<H4>match_results size</H4>
|
||||
<PRE>size_type size()const;</PRE>
|
||||
<B>
|
||||
|
@ -40,7 +40,7 @@
|
||||
by regex_match, regex_search or regex_grep):<BR>
|
||||
</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>
|
||||
<TD vAlign="top" width="20%"> </TD>
|
||||
<TD vAlign="top" width="20%">Result</TD>
|
||||
@ -169,11 +169,11 @@ void search(std::istream& is)
|
||||
<HR>
|
||||
<P></P>
|
||||
<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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
|
@ -158,8 +158,7 @@
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_PERL </TD>
|
||||
<TD vAlign="top" width="45%"> A shortcut for perl-like behavior: REG_EXTENDED
|
||||
| REG_NOCOLLATE | REG_ESCAPE_IN_LISTS</TD>
|
||||
<TD vAlign="top" width="45%">Compiles Perl like regular expressions.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
@ -277,7 +276,7 @@
|
||||
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> 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> 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
|
||||
|
@ -24,9 +24,9 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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. 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>
|
||||
<H3>Algorithm regex_format</H3>
|
||||
<H3></H3>
|
||||
@ -63,8 +63,6 @@ std::basic_string<charT> regex_format
|
||||
<B>const</B> std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = 0);</PRE>
|
||||
<P>Parameters to the main version of the function are passed as follows:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
@ -100,8 +98,6 @@ std::basic_string<charT> regex_format
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><A name="format_flags"></A>Format flags are defined as follows:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
@ -140,9 +136,6 @@ std::basic_string<charT> regex_format
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html">
|
||||
format strings</A>
|
||||
.
|
||||
@ -154,7 +147,7 @@ std::basic_string<charT> regex_format
|
||||
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> 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> 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
|
||||
|
@ -24,7 +24,7 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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>
|
||||
<P>The following documentation is taken unchanged from the previous boost release,
|
||||
and will not be updated in future.</P>
|
||||
@ -57,9 +57,7 @@
|
||||
<B>const</B> basic_regex<charT, traits, Allocator>& e,
|
||||
<B>unsigned</B> flags = match_default);</PRE>
|
||||
<P>The parameters for the primary version of regex_grep have the following
|
||||
meanings:
|
||||
<BR>
|
||||
|
||||
meanings:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -97,8 +95,8 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P> The algorithm finds all of the non-overlapping matches of the expression
|
||||
e, for each match it fills a <A href="#reg_match">match_results</A><iterator,
|
||||
<P>The algorithm finds all of the non-overlapping matches of the expression e, for
|
||||
each match it fills a <A href="#reg_match">match_results</A><iterator,
|
||||
Allocator> structure, which contains information on what matched, and calls
|
||||
the predicate foo, passing the match_results<iterator, Allocator> as a
|
||||
single argument. If the predicate returns true, then the grep operation
|
||||
@ -364,11 +362,11 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
|
||||
<HR>
|
||||
<P></P>
|
||||
<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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<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>
|
||||
<B>
|
||||
<P>
|
||||
@ -71,7 +71,7 @@ public:
|
||||
match_flag_type m = match_default);</PRE>
|
||||
<B>
|
||||
<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
|
||||
using match flags <EM>m</EM>. The object <EM>re </EM>must exist for the
|
||||
lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator& that);</PRE>
|
||||
@ -93,11 +93,10 @@ public:
|
||||
Effects: </B>returns <CODE>!(*this == that)</CODE>.</P>
|
||||
<H5>RE.8.1.1 regex_iterator dereference</H5>
|
||||
<PRE>const value_type& operator*();</PRE>
|
||||
<B>
|
||||
<P>
|
||||
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,
|
||||
whose members are set as follows:</P>
|
||||
<P>
|
||||
<B>Effects:</B> dereferencing a regex_iterator object <EM>it</EM> yields a
|
||||
const reference to a <A href="match_results.html">match_results</A> object,
|
||||
whose members are set as follows:</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
@ -196,9 +195,9 @@ public:
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>(*it)[0].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><CODE>
|
||||
<TD vAlign="top" width="50%">
|
||||
<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
|
||||
set).</P></TD>
|
||||
</TR>
|
||||
@ -229,7 +228,6 @@ public:
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < (*it).size(), true if sub-expression <I>n</I> participated
|
||||
in the match, false otherwise.</P>
|
||||
<P></P>
|
||||
</TD>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">(*it).position(n)</TD>
|
||||
|
@ -2,76 +2,80 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: bad_expression</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<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>
|
||||
<H3>Synopsis</H3>
|
||||
<P>#include <<A href="../../boost/regex/pattern_except.hpp">boost/pat_except.hpp</A>>
|
||||
</P>
|
||||
<P>The class <CODE>bad_expression</CODE> defines the type of objects thrown as
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">class bad_expression</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<hr>
|
||||
<h3>Synopsis</h3>
|
||||
<p>#include <<a href="../../boost/regex/pattern_except.hpp">boost/pattern_except.hpp</a>></p>
|
||||
<p>The class <code>bad_expression</code> defines the type of objects thrown as
|
||||
exceptions to report errors during the conversion from a string representing a
|
||||
regular expression to a finite state machine. </P>
|
||||
<PRE><B>namespace</B> boost{
|
||||
regular expression to a finite state machine. </p>
|
||||
<pre>
|
||||
<b>namespace</b> boost{
|
||||
|
||||
<B>class</B> bad_pattern : <B>public</B> std::runtime_error
|
||||
<b>class</b> bad_pattern : <b>public</b> std::runtime_error
|
||||
{
|
||||
<B>public</B>:
|
||||
<B>explicit</B> bad_pattern(<B>const</B> std::string& s) : std::runtime_error(s){};
|
||||
<b>public</b>:
|
||||
<b>explicit</b> bad_pattern(<b>const</b> std::string& s) : std::runtime_error(s){};
|
||||
};
|
||||
|
||||
<B>class</B> bad_expression : <B>public</B> bad_pattern
|
||||
<b>class</b> bad_expression : <b>public</b> bad_pattern
|
||||
{
|
||||
<B>public</B>:
|
||||
bad_expression(<B>const</B> std::string& s) : bad_pattern(s) {}
|
||||
<b>public</b>:
|
||||
bad_expression(<b>const</b> std::string& s) : bad_pattern(s) {}
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost</PRE>
|
||||
<H3>Description</H3>
|
||||
<PRE>bad_expression(const string& what_arg); </PRE>
|
||||
<P><B>Effects:</B> Constructs an object of class <CODE>bad_expression</CODE>.</P>
|
||||
<B>
|
||||
<P>
|
||||
Postcondition:</B> <CODE>strcmp(what(), what_arg.c_str()) == 0</CODE>.
|
||||
<P>Footnotes: the class <I>bad_pattern </I>forms the base class for all
|
||||
pattern-matching exceptions, of which <I>bad_expression</I> is one. The choice
|
||||
of <I>std::runtime_error </I>as the base class for <I>bad_pattern</I>
|
||||
is moot, depending upon how the library is used exceptions may be either logic
|
||||
errors (programmer supplied expressions) or run time errors (user supplied
|
||||
expressions).
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
} // namespace boost
|
||||
</pre>
|
||||
<h3>Description</h3>
|
||||
<pre>
|
||||
bad_expression(const string& what_arg);
|
||||
</pre>
|
||||
<p><b>Effects:</b> Constructs an object of class <code>bad_expression</code>.</p>
|
||||
<b></b>
|
||||
<p><b>Postcondition:</b> <code>strcmp(what(), what_arg.c_str()) == 0</code>.</p>
|
||||
<p>Footnotes: the class <i>bad_pattern</i> forms the base class for all
|
||||
pattern-matching exceptions, of which <i>bad_expression</i> is one. The choice
|
||||
of <i>std::runtime_error</i> as the base class for <i>bad_pattern</i> is moot;
|
||||
depending upon how the library is used exceptions may be either logic errors
|
||||
(programmer supplied expressions) or run time errors (user supplied
|
||||
expressions).</p>
|
||||
<p></p>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
<!--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> 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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
||||
2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p align="left"><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
1585
doc/basic_regex.html
1585
doc/basic_regex.html
File diff suppressed because it is too large
Load Diff
@ -1,163 +1,245 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Configuration and setup</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Configuration and setup</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<h2>Contents</h2>
|
||||
<dl class="index">
|
||||
<dt><a href="#compiler">Compiler setup</a></dt>
|
||||
<dt><a href="#locale">Locale and traits class selection</a></dt>
|
||||
<dt><a href="#linkage">Linkage Options</a></dt>
|
||||
<dt><a href="#algorithm">Algorithm Selection</a></dt>
|
||||
<dt><a href="#tuning">Algorithm Tuning</a></dt>
|
||||
</dl>
|
||||
<H3><A name="compiler"></A>Compiler setup.</H3>
|
||||
<P>You shouldn't need to do anything special to configure boost.regex for use with
|
||||
your compiler - the <A href="../../config/index.html">boost.config</A> subsystem
|
||||
should already take care of it, if you do have problems (or you are using a
|
||||
particularly obscure compiler or platform) then <A href="../../config/index.html">boost.config</A> has
|
||||
a <A href="../../config/config.htm#config_script">configure</A> script.</P>
|
||||
<H3><A name="locale"></A>Locale and traits class selection.</H3>
|
||||
<P>The following macros (see <A href="../../../boost/regex/user.hpp">user.hpp</A>)
|
||||
control how boost.regex interacts with the users locale:</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_USE_C_LOCALE</TD>
|
||||
<TD>Forces boost.regex to use the global C locale in it's traits class support:
|
||||
this is the default behaviour on non-windows platforms, but MS Windows
|
||||
platforms normally use the Win32 API for locale support.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_USE_CPP_LOCALE</TD>
|
||||
<TD>Forces boost.regex to use std::locale in it's default traits class, regular
|
||||
expressions can then be imbued with an instance specific locale.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="265">BOOST_REGEX_NO_W32</TD>
|
||||
<TD>Tells boost.regex not to use any Win32 API's even when available (implies
|
||||
BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="linkage"></A>Linkage Options</H3>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_STATIC_LINK</TD>
|
||||
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it is going
|
||||
to be linked to a static library even when using a dynamic C runtime.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_NO_LIB</TD>
|
||||
<TD>For Microsoft and Borland C++ builds, this tells boost.regex that it should
|
||||
not automatically select the library to link to.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="algorithm"></A>Algorithm Selection</H3>
|
||||
<P>
|
||||
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_V3</TD>
|
||||
<TD>Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if
|
||||
you need maximum compatibility with previous behaviour.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_RECURSIVE</TD>
|
||||
<TD>Tells boost.regex to use a stack-recursive matching algorithm. This is
|
||||
generally the fastest option (although there is very little in it), but can
|
||||
cause stack overflow in extreme cases, on Win32 this can be handled safely, but
|
||||
this is not the case on other platforms.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="253">BOOST_REGEX_NON_RECURSIVE</TD>
|
||||
<TD>Tells boost.regex to use a non-stack recursive matching algorithm, this can be
|
||||
slightly slower than the alternative, but is always safe no matter how
|
||||
pathological the regular expression. This is the default on non-Win32
|
||||
platforms.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<H3><A name="tuning"></A>Algorithm Tuning</H3>
|
||||
<P>The following option applies only if BOOST_REGEX_RECURSIVE is set.</P>
|
||||
<P>
|
||||
<TABLE id="Table6" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_HAS_MS_STACK_GUARD</TD>
|
||||
<TD>Tells boost.regex that Microsoft style __try - __except blocks are supported,
|
||||
and can be used to safely trap stack overflow.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</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. This defaults to 4096 bytes, which is
|
||||
large enough to match the vast majority of regular expressions without
|
||||
further allocations, however, you can choose smaller or larger values depending
|
||||
upon your platforms characteristics.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_MAX_BLOCKS</TD>
|
||||
<TD>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is
|
||||
permitted to use. If this value is exceeded then boost.regex will stop
|
||||
trying to find a match and throw a std::runtime_error. Defaults to 1024,
|
||||
don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>BOOST_REGEX_MAX_CACHE_BLOCKS</TD>
|
||||
<TD>Tells boost.regex how many memory blocks to store in it's internal cache -
|
||||
memory blocks are taken from this cache rather than by calling ::operator
|
||||
new. Generally speeking this can be an order of magnitude faster than
|
||||
calling ::opertator new each time a memory block is required, but has the
|
||||
downside that boost.regex can end up caching a large chunk of memory (by
|
||||
default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If memory is
|
||||
tight then try defining this to 0 (disables all caching), or if that is too
|
||||
slow, then a value of 1 or 2, may be sufficient. On the other hand, on
|
||||
large multi-processor, multi-threaded systems, you may find that a higher value
|
||||
is in order.</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<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> 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>
|
||||
<head>
|
||||
<title>Boost.Regex: Configuration and setup</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1" >
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Configuration and setup</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2>Contents</h2>
|
||||
|
||||
<dl class="index">
|
||||
<dt><a href="#compiler">Compiler setup</a>
|
||||
|
||||
<dt><a href="#locale">Locale and traits class selection</a>
|
||||
|
||||
<dt><a href="#linkage">Linkage Options</a>
|
||||
|
||||
<dt><a href="#algorithm">Algorithm Selection</a>
|
||||
|
||||
<dt><a href="#tuning">Algorithm Tuning</a></dt>
|
||||
</dl>
|
||||
|
||||
<h3><a name="compiler"></a>Compiler setup.</h3>
|
||||
|
||||
<p>You shouldn't need to do anything special to configure
|
||||
boost.regex for use with your compiler - the <a href="../../config/index.html">boost.config</a> subsystem should already
|
||||
take care of it, if you do have problems (or you are using a
|
||||
particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a> has a <a href="../../config/config.htm#config_script">configure</a> script.</p>
|
||||
|
||||
<h3><a name="locale"></a>Locale and traits class selection.</h3>
|
||||
|
||||
<p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) control how
|
||||
boost.regex interacts with the user's locale:</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table2" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_C_LOCALE</td>
|
||||
<td>Forces boost.regex to use the global C locale in its traits
|
||||
class support: this is the default behavior on non-windows
|
||||
platforms, but MS Windows platforms normally use the Win32 API for
|
||||
locale support.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
|
||||
<td>Forces boost.regex to use std::locale in it's default traits
|
||||
class, regular expressions can then be imbued with an
|
||||
instance specific locale.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="265">BOOST_REGEX_NO_W32</td>
|
||||
<td>Tells boost.regex not to use any Win32 API's even when
|
||||
available (implies BOOST_REGEX_USE_C_LOCALE unless
|
||||
BOOST_REGEX_USE_CPP_LOCALE is set).</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="linkage"></a>Linkage Options</h3>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table3" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_DYN_LINK</td>
|
||||
<td>For Microsoft and Borland C++ builds, this tells
|
||||
boost.regex that it should link to the dll build of the boost.regex. By default
|
||||
boost.regex will link to its static library build, even if the dynamic C runtime library
|
||||
is in use.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_NO_LIB</td>
|
||||
<td>For Microsoft and Borland C++ builds, this tells boost.regex
|
||||
that it should not automatically select the library to link
|
||||
to.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="algorithm"></a>Algorithm Selection</h3>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table4" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_V3</td>
|
||||
<td>Tells boost.regex to use the boost-1.30.0 matching algorithm,
|
||||
define only if you need maximum compatibility with previous
|
||||
behavior.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_RECURSIVE</td>
|
||||
<td>Tells boost.regex to use a stack-recursive matching
|
||||
algorithm. This is generally the fastest option (although
|
||||
there is very little in it), but can cause stack overflow in
|
||||
extreme cases, on Win32 this can be handled safely, but this is not
|
||||
the case on other platforms.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="253">BOOST_REGEX_NON_RECURSIVE</td>
|
||||
<td>Tells boost.regex to use a non-stack recursive matching
|
||||
algorithm, this can be slightly slower than the alternative, but is
|
||||
always safe no matter how pathological the regular
|
||||
expression. This is the default on non-Win32 platforms.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="tuning"></a>Algorithm Tuning</h3>
|
||||
|
||||
<p>The following option applies only if BOOST_REGEX_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<table id="Table6" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="1">
|
||||
<tr>
|
||||
<td>BOOST_REGEX_HAS_MS_STACK_GUARD</td>
|
||||
<td>Tells boost.regex that Microsoft style __try - __except blocks
|
||||
are supported, and can be used to safely trap stack overflow.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<p>The following options apply only if BOOST_REGEX_NON_RECURSIVE is
|
||||
set.</p>
|
||||
|
||||
<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.
|
||||
This defaults to 4096 bytes, which is large enough to match the
|
||||
vast majority of regular expressions without further
|
||||
allocations, however, you can choose smaller or larger values
|
||||
depending upon your platforms characteristics.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_BLOCKS</td>
|
||||
<td>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE
|
||||
it is permitted to use. If this value is exceeded then
|
||||
boost.regex will stop trying to find a match and throw a
|
||||
std::runtime_error. Defaults to 1024, don't forget to tweek
|
||||
this value if you alter BOOST_REGEX_BLOCKSIZE by much.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>BOOST_REGEX_MAX_CACHE_BLOCKS</td>
|
||||
<td>Tells boost.regex how many memory blocks to store in it's
|
||||
internal cache - memory blocks are taken from this cache rather
|
||||
than by calling ::operator new. Generally speeking this can
|
||||
be an order of magnitude faster than calling ::opertator new each
|
||||
time a memory block is required, but has the downside that
|
||||
boost.regex can end up caching a large chunk of memory (by default
|
||||
up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If
|
||||
memory is tight then try defining this to 0 (disables all caching),
|
||||
or if that is too slow, then a value of 1 or 2, may be
|
||||
sufficient. On the other hand, on large multi-processor,
|
||||
multi-threaded systems, you may find that a higher value is in
|
||||
order.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<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> 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>
|
||||
|
@ -1,86 +1,111 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Contacts</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
|
||||
<TR>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||
</td>
|
||||
<TD width="353">
|
||||
<H1 align="center">Boost.Regex</H1>
|
||||
<H2 align="center">Contacts and Acknowledgements</H2>
|
||||
</TD>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||
</td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<HR>
|
||||
<p></p>
|
||||
<P>The author can be contacted at <A href="mailto:John_Maddock@compuserve.com">John_Maddock@compuserve.com</A>,
|
||||
the home page for this library is at <A href="http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm">
|
||||
http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm</A>, and
|
||||
the official boost version can be obtained from <A href="../libraries.htm">www.boost.org/libraries.htm</A>.
|
||||
</P>
|
||||
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think
|
||||
about algorithms and their performance, and to the folks at boost for forcing
|
||||
me to <I>think</I>, period. The following people have all contributed useful
|
||||
comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
|
||||
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias
|
||||
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones,
|
||||
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens
|
||||
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
|
||||
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc
|
||||
Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals
|
||||
supplied with the Henry Spencer, Perl and GNU regular expression libraries -
|
||||
wherever possible I have tried to maintain compatibility with these libraries
|
||||
and with the POSIX standard - the code however is entirely my own, including
|
||||
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know
|
||||
about, so if you have any comments or spot any bugs, please get in touch.
|
||||
</P>
|
||||
<P>Useful further information can be found at:
|
||||
</P>
|
||||
<P>A short tutorial on regular expressions <A href="http://www.devshed.com/Server_Side/Administration/RegExp/">
|
||||
can be found here</A>.</P>
|
||||
<P>The <A href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
|
||||
Specification</A> contains a wealth of useful material, including the
|
||||
regular expression syntax, and specifications for <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
|
||||
<regex.h></A> and <A href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
|
||||
<nl_types.h></A>.
|
||||
</P>
|
||||
<P>The <A href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern Matching Pointers</A>
|
||||
site is a "must visit" resource for anyone interested in pattern matching.
|
||||
</P>
|
||||
<P><A href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</A>, use a
|
||||
simplified regular expression syntax to achieve faster search times.
|
||||
</P>
|
||||
<P><A href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</A> and <A href="http://www.dcc.uchile.cl/~rbaeza/">
|
||||
Ricardo Baeza-Yates</A>
|
||||
both have a selection of useful pattern matching papers available from their
|
||||
respective web sites.
|
||||
<P>
|
||||
<HR>
|
||||
<P></P>
|
||||
<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> 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>
|
||||
<head>
|
||||
<title>Boost.Regex: Contacts</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=iso-8859-1" >
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<p></p>
|
||||
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
||||
border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../c++boost.gif" border=0></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
|
||||
<h2 align="center">Contacts and Acknowledgements</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
||||
"Boost.Regex Index" src="uarrow.gif" border=0></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>The author can be contacted at <a href="mailto:john_maddock@compuserve.com">
|
||||
john_maddock@compuserve.com</a>, the home page for this library is
|
||||
at <a href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm">
|
||||
http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm</a>,
|
||||
and the official boost version can be obtained from <a href="../libraries.htm">www.boost.org/libraries.htm</a>.</p>
|
||||
|
||||
<p>I am indebted to Robert Sedgewick's "Algorithms in C++" for
|
||||
forcing me to think about algorithms and their performance, and to
|
||||
the folks at boost for forcing me to <i>think</i>, period. The
|
||||
following people have all contributed useful comments or fixes:
|
||||
Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian,
|
||||
Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
|
||||
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
|
||||
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink,
|
||||
Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
|
||||
Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander
|
||||
Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc Recht, Scott
|
||||
VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
|
||||
the manuals supplied with the Henry Spencer, Perl and GNU regular
|
||||
expression libraries - wherever possible I have tried to maintain
|
||||
compatibility with these libraries and with the POSIX standard -
|
||||
the code however is entirely my own, including any bugs! I can
|
||||
absolutely guarantee that I will not fix any bugs I don't know
|
||||
about, so if you have any comments or spot any bugs, please get in
|
||||
touch.</p>
|
||||
|
||||
<p>Useful further information can be found at:</p>
|
||||
|
||||
<p>A short tutorial on regular expressions <a href="http://www.devshed.com/Server_Side/Administration/RegExp/">can be
|
||||
found here</a>.</p>
|
||||
|
||||
<p>The <a href="http://www.opengroup.org/onlinepubs/7908799/toc.htm">Open Unix
|
||||
Specification</a> contains a wealth of useful material, including
|
||||
the regular expression syntax, and specifications for <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/regex.h.html">
|
||||
<regex.h></a> and <a href="http://www.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html">
|
||||
<nl_types.h></a>.</p>
|
||||
|
||||
<p>The <a href="http://www.cs.ucr.edu/~stelo/pattern.html">Pattern
|
||||
Matching Pointers</a> site is a "must visit" resource for anyone
|
||||
interested in pattern matching.</p>
|
||||
|
||||
<p><a href="http://glimpse.cs.arizona.edu/">Glimpse and Agrep</a>,
|
||||
use a simplified regular expression syntax to achieve faster search
|
||||
times.</p>
|
||||
|
||||
<p><a href="http://glimpse.cs.arizona.edu/udi.html">Udi Manber</a>
|
||||
and <a href="http://www.dcc.uchile.cl/~rbaeza/">Ricardo
|
||||
Baeza-Yates</a> both have a selection of useful pattern matching
|
||||
papers available from their respective web sites.</p>
|
||||
|
||||
<p></p>
|
||||
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->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> 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>
|
||||
|
@ -2,60 +2,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Regex: Examples</title>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
</head>
|
||||
<body>
|
||||
<P>
|
||||
<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>
|
||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../c++boost.gif" width="277" border="0"></a></h3>
|
||||
</td>
|
||||
<td width="353">
|
||||
<h1 align="center">Boost.Regex</h1>
|
||||
<h2 align="center">Examples</h2>
|
||||
</td>
|
||||
<td width="50">
|
||||
<h3><a href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<BR>
|
||||
<BR>
|
||||
<HR>
|
||||
<P>There are three demo applications that ship with this library, they all come
|
||||
with makefiles for Borland, Microsoft and gcc compilers, otherwise you will
|
||||
have to create your own makefiles.
|
||||
</P>
|
||||
<H5>regress.exe:
|
||||
</H5>
|
||||
have to create your own makefiles.</P>
|
||||
<H5>regress.exe:</H5>
|
||||
<P>A regression test application that gives the matching/searching algorithms a
|
||||
full workout. The presence of this program is your guarantee that the library
|
||||
will behave as claimed - at least as far as those items tested are concerned -
|
||||
if anyone spots anything that isn't being tested I'd be glad to hear about it.
|
||||
</P>
|
||||
if anyone spots anything that isn't being tested I'd be glad to hear about it.</P>
|
||||
<P>Files: <A href="../test/regress/parse.cpp">parse.cpp</A>, <A href="../test/regress/regress.cpp">
|
||||
regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.
|
||||
</P>
|
||||
<H5>jgrep.exe
|
||||
</H5>
|
||||
regress.cpp</A>, <A href="../test/regress/tests.cpp">tests.cpp</A>.</P>
|
||||
<H5>jgrep.exe</H5>
|
||||
<P>A simple grep implementation, run with no command line options to find out its
|
||||
usage. Look at <A href="../src/fileiter.cpp">fileiter.cpp</A>/fileiter.hpp and
|
||||
the mapfile class to see an example of a "smart" bidirectional iterator that
|
||||
can be used with boost.regex or any other STL algorithm.
|
||||
</P>
|
||||
can be used with boost.regex or any other STL algorithm.</P>
|
||||
<P>Files: <A href="../example/jgrep/jgrep.cpp">jgrep.cpp</A>, <A href="../example/jgrep/main.cpp">
|
||||
main.cpp</A>.
|
||||
</P>
|
||||
<H5>timer.exe
|
||||
</H5>
|
||||
main.cpp</A>.</P>
|
||||
<H5>timer.exe</H5>
|
||||
<P>A simple interactive expression matching application, the results of all
|
||||
matches are timed, allowing the programmer to optimize their regular
|
||||
expressions where performance is critical.
|
||||
</P>
|
||||
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.
|
||||
</P>
|
||||
expressions where performance is critical.</P>
|
||||
<P>Files: <A href="../example/timer/regex_timer.cpp">regex_timer.cpp</A>.</P>
|
||||
<H5>Code snippets</H5>
|
||||
<P>The snippets examples contain the code examples used in the documentation:</P>
|
||||
<P><A href="../example/snippets/credit_card_example.cpp">credit_card_example.cpp</A>:
|
||||
@ -68,8 +59,7 @@
|
||||
regex_grep example 1: searches a cpp file for class definitions.</P>
|
||||
<P><A href="../example/snippets/regex_grep_example_2.cpp">regex_grep_example_2.cpp</A>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a global
|
||||
callback function.
|
||||
</P>
|
||||
callback function.</P>
|
||||
<P><A href="../example/snippets/regex_grep_example_3.cpp">regex_grep_example_3.cpp</A>:
|
||||
regex_grep example 2: searches a cpp file for class definitions, using a bound
|
||||
member function callback.</P>
|
||||
@ -87,21 +77,23 @@
|
||||
<P><A href="../example/snippets/regex_split_example_1.cpp">regex_split_example_1.cpp</A>:
|
||||
regex_split example: split a string into tokens.</P>
|
||||
<P><A href="../example/snippets/regex_split_example_2.cpp">regex_split_example_2.cpp</A>
|
||||
: regex_split example: spit out linked URL's.
|
||||
<P>
|
||||
<HR>
|
||||
: regex_split example: spit out linked URL's.</P>
|
||||
<P></P>
|
||||
<HR>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
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> 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
|
||||
<!--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> 1998-
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||
<p><i>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,7 +28,7 @@
|
||||
regex_merge</A> and by <A href="match_results.html">match_results::format</A>,
|
||||
and are used to transform one string into another.
|
||||
</P>
|
||||
<P>There are three kind of format string: sed, perl and extended, the extended
|
||||
<P>There are three kind of format string: sed, Perl and extended, the extended
|
||||
syntax is a superset of the others so this is covered first.
|
||||
</P>
|
||||
<P><B><I>Extended format syntax</I></B>
|
||||
@ -49,7 +49,7 @@
|
||||
<BR>
|
||||
<I>Sub-expression expansions:</I>
|
||||
</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:
|
||||
<BR>
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
<TR>
|
||||
<TD vAlign="top" width="8%"> </TD>
|
||||
<TD vAlign="top" width="40%">\x{}</TD>
|
||||
<TD vAlign="top" width="43%">A possible unicode hexadecimal character - for
|
||||
<TD vAlign="top" width="43%">A possible Unicode hexadecimal character - for
|
||||
example \x{1A0}</TD>
|
||||
<TD vAlign="top" width="9%"> </TD>
|
||||
</TR>
|
||||
|
@ -24,7 +24,20 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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>
|
||||
<HR>
|
||||
<P></P>
|
||||
@ -33,7 +46,7 @@
|
||||
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> 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> 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
|
||||
|
@ -134,9 +134,9 @@
|
||||
directly to your project then define BOOST_REGEX_NO_LIB to disable automatic
|
||||
library selection.</P>
|
||||
<P><STRONG><I>Important</I></STRONG><EM>: there have been some reports of
|
||||
compiler-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
|
||||
/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
|
||||
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
|
||||
|
@ -26,16 +26,16 @@
|
||||
<p></p>
|
||||
<P>Regular expressions are a form of pattern-matching that are often used in text
|
||||
processing; many users will be familiar with the Unix utilities <I>grep</I>, <I>sed</I>
|
||||
and <I>awk</I>, and the programming language <I>perl</I>, each of which make
|
||||
and <I>awk</I>, and the programming language <I>Perl</I>, each of which make
|
||||
extensive use of regular expressions. Traditionally C++ users have been limited
|
||||
to the POSIX C API's for manipulating regular expressions, and while regex++
|
||||
does provide these API's, they do not represent the best way to use the
|
||||
library. For example regex++ can cope with wide character strings, or search
|
||||
and replace operations (in a manner analogous to either sed or perl), something
|
||||
and replace operations (in a manner analogous to either sed or Perl), something
|
||||
that traditional C libraries can not do.</P>
|
||||
<P>The class <A href="basic_regex.html">boost::basic_regex</A> is the key class in
|
||||
this library; it represents a "machine readable" regular expression, and is
|
||||
very closely 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
|
||||
std::basic_string there are two typedefs that are almost always the means by
|
||||
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
|
||||
expression [0-9], however ranges of characters like this are actually locale
|
||||
dependent. Instead we should use the POSIX standard form [[:digit:]], or the
|
||||
regex++ and perl shorthand for this \d (note that many older libraries tended
|
||||
regex++ and Perl shorthand for this \d (note that many older libraries tended
|
||||
to be hard-coded to the C-locale, consequently this was not an issue for them).
|
||||
That leaves us with the following regular expression to validate credit card
|
||||
number formats:</P>
|
||||
<P>(\d{4}[- ]){3}\d{4}</P>
|
||||
<P>Here the parenthesis act to group (and mark for future reference)
|
||||
sub-expressions, and the {4} means "repeat exactly 4 times". This is an example
|
||||
of the extended regular expression syntax used by perl, awk and egrep. Regex++
|
||||
of the extended regular expression syntax used by Perl, awk and egrep. Regex++
|
||||
also supports the older "basic" syntax used by sed and grep, but this is
|
||||
generally less useful, unless you already have some basic regular expressions
|
||||
that you need to reuse.</P>
|
||||
<P>Now 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>
|
||||
<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
|
||||
(for example VC6), then you will have to add some boost:: prefixes to some of
|
||||
the function calls in the examples.</P>
|
||||
<P>Those of you who are familiar with credit card processing, will have 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,
|
||||
it does not represent the format required by online credit card systems; these
|
||||
require the number as a string of 16 (or possibly 15) digits, without any
|
||||
intervening spaces. What we need is a means to convert easily between the two
|
||||
formats, and this is where search and replace comes in. Those who are familiar
|
||||
with the utilities <I>sed</I> and <I>perl</I> will already be ahead here; we
|
||||
with the utilities <I>sed</I> and <I>Perl</I> will already be ahead here; we
|
||||
need two strings - one a regular expression - the other a "<A href="format_syntax.html">format
|
||||
string</A>" that provides a description of the text to replace the match
|
||||
with. In regex++ this search and replace operation is performed with the
|
||||
@ -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
|
||||
classes - as well as providing compatibility with other regular expression
|
||||
libraries including GNU and BSD4 regex packages, and to a more limited extent
|
||||
perl 5.
|
||||
Perl 5.
|
||||
</P>
|
||||
<P>
|
||||
<HR>
|
||||
@ -172,3 +172,4 @@ std::string human_readable_card_number(<B>const</B> std::string s)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
@ -50,8 +50,8 @@
|
||||
LC_TYPE and LC_COLLATE categories.
|
||||
</P>
|
||||
<P>There are three separate localization mechanisms supported by boost.regex:</P>
|
||||
<P><I>Win32 localization model.</I>
|
||||
</P>
|
||||
<H3>Win32 localization model.
|
||||
</H3>
|
||||
<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
|
||||
there is a single global locale as defined by the user's control panel
|
||||
@ -65,7 +65,7 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::w32_regex_traits<char>::set_message_catalogue("mydll.dll");
|
||||
</P>
|
||||
@ -77,8 +77,8 @@
|
||||
under NT, under Windows 9x the library degrades gracefully - characters 0 to
|
||||
255 are supported, the remainder are treated as "unknown" graphic characters.
|
||||
</P>
|
||||
<P><I>C localization model.</I>
|
||||
</P>
|
||||
<H3>C localization model.
|
||||
</H3>
|
||||
<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>,
|
||||
Win32 users can force this model to take effect by defining the pre-processor
|
||||
@ -92,7 +92,7 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::c_regex_traits<char>::set_message_catalogue("mycatalogue");
|
||||
</P>
|
||||
@ -107,12 +107,12 @@
|
||||
behave equivalent to most traditional regular expression libraries including
|
||||
version 1 of this library.
|
||||
</P>
|
||||
<P><I><TT>C++ </TT></I><I>localization</I><I><TT> </TT></I><I>model</I><I><TT>.</TT></I>
|
||||
</P>
|
||||
<H3>C++ localization model.
|
||||
</H3>
|
||||
<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
|
||||
instance of reg_expression<> has its own instance of std::locale, class
|
||||
reg_expression<> also has a member function <I>imbue</I> which allows the
|
||||
instance of basic_regex<> has its own instance of std::locale, class
|
||||
basic_regex<> 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
|
||||
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
|
||||
@ -122,14 +122,14 @@
|
||||
</P>
|
||||
<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
|
||||
necessarily before you construct any <I>reg_expression</I> instances):
|
||||
necessarily before you construct any <I>basic_regex</I> instances):
|
||||
</P>
|
||||
<P>boost::cpp_regex_traits<char>::set_message_catalogue("mycatalogue");
|
||||
</P>
|
||||
<P>Note that calling reg_expression<>::imbue will invalidate any expression
|
||||
currently compiled in that instance of reg_expression<>. This model is
|
||||
the one which closest fits the ethos of the C++ standard library, however it is
|
||||
the model which will produce the slowest code, and which is the least well
|
||||
<P>Note that calling basic_regex<>::imbue will invalidate any expression
|
||||
currently compiled in that instance of basic_regex<>. This model is the
|
||||
one which closest fits the ethos of the C++ standard library, however it is the
|
||||
model which will produce the slowest code, and which is the least well
|
||||
supported by current standard library implementations, for example I have yet
|
||||
to find an implementation of std::locale which supports either message
|
||||
catalogues, or locales other than "C" or "POSIX".
|
||||
@ -141,8 +141,8 @@
|
||||
<boost/cregex.hpp> in your code. The best way to ensure this is to add
|
||||
the #define to <boost/regex/user.hpp>.
|
||||
</P>
|
||||
<P><I>Providing a message catalogue:</I>
|
||||
</P>
|
||||
<H3>Providing a message catalogue:
|
||||
</H3>
|
||||
<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
|
||||
dll's string table (Win32 model), or a POSIX message catalogue (C or C++
|
||||
@ -728,12 +728,7 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Custom error messages are loaded as follows:
|
||||
<BR>
|
||||
|
||||
<P>Custom error messages are loaded as follows:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -929,12 +924,7 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Custom character class names are loaded as followed:
|
||||
<BR>
|
||||
|
||||
<P>Custom character class names are loaded as followed:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table4" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -1090,9 +1080,6 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>Finally, custom collating element names are loaded starting from message id
|
||||
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
|
||||
|
@ -134,13 +134,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Constructs an object of class match_results. The postconditions
|
||||
of this function are indicated in Table RE16:</P><I>
|
||||
<H6 align="center">
|
||||
Table RE16--</I>match_results(const Allocator&)<I> effects</H6>
|
||||
<P>
|
||||
<DIV align="center">
|
||||
<P></P>
|
||||
</I>
|
||||
of this function are indicated in the table:</P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
@ -182,7 +176,9 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
</TR>
|
||||
</TBODY></TD></TR></TABLE></CENTER>
|
||||
<P></P>
|
||||
</DIV><PRE>match_results(const match_results& m);</PRE>
|
||||
<DIV></DIV>
|
||||
<P> </P>
|
||||
<PRE>match_results(const match_results& m);</PRE>
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Constructs an object of class match_results, as a copy of
|
||||
@ -190,26 +186,22 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
<B>
|
||||
<P>
|
||||
Effects:</B> Assigns m to *this. The postconditions of this function are
|
||||
indicated in Table RE17:</P>
|
||||
<H6 align="center">Table RE17--match_results(const Allocator&) effects</H6>
|
||||
<P>
|
||||
<DIV align="center">
|
||||
<P></P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Element</B>
|
||||
</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Value</B>
|
||||
indicated in the table:</P>
|
||||
<P align="center">
|
||||
<CENTER>
|
||||
<TABLE id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Element</B>
|
||||
</P>
|
||||
</TD></TR>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><B>
|
||||
<P>
|
||||
Value</B> </P>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>empty()</P>
|
||||
@ -277,7 +269,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
</TR>
|
||||
</TBODY></TD></TR></TABLE></CENTER>
|
||||
<P></P>
|
||||
</DIV>
|
||||
<DIV></DIV>
|
||||
<H4>match_results size</H4>
|
||||
<PRE>size_type size()const;</PRE>
|
||||
<B>
|
||||
|
@ -40,7 +40,7 @@
|
||||
by regex_match, regex_search or regex_grep):<BR>
|
||||
</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>
|
||||
<TD vAlign="top" width="20%"> </TD>
|
||||
<TD vAlign="top" width="20%">Result</TD>
|
||||
@ -169,11 +169,11 @@ void search(std::istream& is)
|
||||
<HR>
|
||||
<P></P>
|
||||
<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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
|
@ -158,8 +158,7 @@
|
||||
<TR>
|
||||
<TD width="5%"> </TD>
|
||||
<TD vAlign="top" width="45%">REG_PERL </TD>
|
||||
<TD vAlign="top" width="45%"> A shortcut for perl-like behavior: REG_EXTENDED
|
||||
| REG_NOCOLLATE | REG_ESCAPE_IN_LISTS</TD>
|
||||
<TD vAlign="top" width="45%">Compiles Perl like regular expressions.</TD>
|
||||
<TD width="5%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
@ -277,7 +276,7 @@
|
||||
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> 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> 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
|
||||
|
@ -24,9 +24,9 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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. 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>
|
||||
<H3>Algorithm regex_format</H3>
|
||||
<H3></H3>
|
||||
@ -63,8 +63,6 @@ std::basic_string<charT> regex_format
|
||||
<B>const</B> std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = 0);</PRE>
|
||||
<P>Parameters to the main version of the function are passed as follows:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
@ -100,8 +98,6 @@ std::basic_string<charT> regex_format
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><A name="format_flags"></A>Format flags are defined as follows:
|
||||
<BR>
|
||||
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table3" cellSpacing="0" cellPadding="7" width="100%" border="0">
|
||||
@ -140,9 +136,6 @@ std::basic_string<charT> regex_format
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P><BR>
|
||||
|
||||
</P>
|
||||
<P>The format string syntax (and available options) is described more fully under <A href="format_syntax.html">
|
||||
format strings</A>
|
||||
.
|
||||
@ -154,7 +147,7 @@ std::basic_string<charT> regex_format
|
||||
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> 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> 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
|
||||
|
@ -24,7 +24,7 @@
|
||||
</P>
|
||||
<HR>
|
||||
<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>
|
||||
<P>The following documentation is taken unchanged from the previous boost release,
|
||||
and will not be updated in future.</P>
|
||||
@ -57,9 +57,7 @@
|
||||
<B>const</B> basic_regex<charT, traits, Allocator>& e,
|
||||
<B>unsigned</B> flags = match_default);</PRE>
|
||||
<P>The parameters for the primary version of regex_grep have the following
|
||||
meanings:
|
||||
<BR>
|
||||
|
||||
meanings:
|
||||
</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="0" cellPadding="7" width="624" border="0">
|
||||
@ -97,8 +95,8 @@
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
<P> The algorithm finds all of the non-overlapping matches of the expression
|
||||
e, for each match it fills a <A href="#reg_match">match_results</A><iterator,
|
||||
<P>The algorithm finds all of the non-overlapping matches of the expression e, for
|
||||
each match it fills a <A href="#reg_match">match_results</A><iterator,
|
||||
Allocator> structure, which contains information on what matched, and calls
|
||||
the predicate foo, passing the match_results<iterator, Allocator> as a
|
||||
single argument. If the predicate returns true, then the grep operation
|
||||
@ -364,11 +362,11 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
|
||||
<HR>
|
||||
<P></P>
|
||||
<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
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P><I><EFBFBD> Copyright <a href="mailto:jm@regex.fsnet.co.uk">John Maddock</a> 1998-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></I></P>
|
||||
<P align="left"><I>Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
</PRE>
|
||||
<H3><A name="description"></A>Description</H3>
|
||||
<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>
|
||||
<B>
|
||||
<P>
|
||||
@ -71,7 +71,7 @@ public:
|
||||
match_flag_type m = match_default);</PRE>
|
||||
<B>
|
||||
<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
|
||||
using match flags <EM>m</EM>. The object <EM>re </EM>must exist for the
|
||||
lifetime of the regex_iterator.</P><PRE>regex_iterator(const regex_iterator& that);</PRE>
|
||||
@ -93,11 +93,10 @@ public:
|
||||
Effects: </B>returns <CODE>!(*this == that)</CODE>.</P>
|
||||
<H5>RE.8.1.1 regex_iterator dereference</H5>
|
||||
<PRE>const value_type& operator*();</PRE>
|
||||
<B>
|
||||
<P>
|
||||
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,
|
||||
whose members are set as follows:</P>
|
||||
<P>
|
||||
<B>Effects:</B> dereferencing a regex_iterator object <EM>it</EM> yields a
|
||||
const reference to a <A href="match_results.html">match_results</A> object,
|
||||
whose members are set as follows:</P>
|
||||
<P>
|
||||
<TABLE id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||
<TBODY>
|
||||
@ -196,9 +195,9 @@ public:
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>(*it)[0].matched</P>
|
||||
</TD>
|
||||
<TD vAlign="top" width="50%"><CODE>
|
||||
<TD vAlign="top" width="50%">
|
||||
<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
|
||||
set).</P></TD>
|
||||
</TR>
|
||||
@ -229,7 +228,6 @@ public:
|
||||
<TD vAlign="top" width="50%">
|
||||
<P>For all integers n < (*it).size(), true if sub-expression <I>n</I> participated
|
||||
in the match, false otherwise.</P>
|
||||
<P></P>
|
||||
</TD>
|
||||
<TR>
|
||||
<TD vAlign="top" width="50%">(*it).position(n)</TD>
|
||||
|
@ -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_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_2.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
|
||||
[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/index.html ]
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,6 +10,10 @@
|
||||
#include <boost/version.hpp>
|
||||
#include "regex_comparison.hpp"
|
||||
|
||||
#ifdef BOOST_HAS_PCRE
|
||||
#include "pcre.h" // for pcre version number
|
||||
#endif
|
||||
|
||||
//
|
||||
// globals:
|
||||
//
|
||||
@ -32,6 +36,20 @@ std::string html_out_file;
|
||||
std::string html_contents;
|
||||
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)
|
||||
{
|
||||
if(what == "-b")
|
||||
@ -196,7 +214,7 @@ std::string html_quote(const std::string& in)
|
||||
{
|
||||
static const boost::regex e("(<)|(>)|(&)|(\")");
|
||||
static const std::string format("(?1<)(?2>)(?3&)(?4")");
|
||||
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)
|
||||
@ -244,21 +262,63 @@ void output_html_results(bool show_description, const std::string& tagname)
|
||||
os << "<td>" << html_quote(first->description) << "</td>";
|
||||
#if defined(BOOST_HAS_GRETA)
|
||||
if(time_greta == true)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
#if defined(BOOST_HAS_POSIX)
|
||||
if(time_boost == true)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
if(time_posix == true)
|
||||
{
|
||||
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(time_pcre == true)
|
||||
{
|
||||
print_result(os, first->pcre_time, first->factor);
|
||||
if(first->pcre_time > 0)
|
||||
{
|
||||
pcre_total += first->pcre_time / first->factor;
|
||||
++pcre_test_count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
os << "</tr>\n";
|
||||
++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()
|
||||
{
|
||||
if(html_out_file.size())
|
||||
@ -306,7 +441,7 @@ void output_final_html()
|
||||
pos = html_contents.find("%boost%");
|
||||
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%");
|
||||
if(pos != std::string::npos)
|
||||
@ -317,7 +452,12 @@ void output_final_html()
|
||||
html_contents.replace(pos, 6, "N/A");
|
||||
#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:
|
||||
//
|
||||
std::ofstream os(html_out_file.c_str());
|
||||
|
@ -8,13 +8,14 @@
|
||||
</head>
|
||||
<body bgcolor="#ffffff" link="#0000ff" vlink="#800080">
|
||||
<h2>Regular Expression Performance Comparison</h2>
|
||||
<p>The Boost and GRETA regular expression libraries have slightly different
|
||||
interfaces, and it has been suggested that GRETA's interface allows for a more
|
||||
efficient implementation. The following tables provide comparisons between:</p>
|
||||
<p>
|
||||
The following tables provide comparisons between the following regular
|
||||
expression libraries:</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://arglist.com/regex/">Henry Spencer's regular expression library</a>
|
||||
- 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>
|
||||
<P>Machine: Intel Pentium 4 2.8GHz PC.</P>
|
||||
<P>Compiler: %compiler%.</P>
|
||||
@ -30,6 +31,11 @@
|
||||
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
|
||||
machine algorithms.</P>
|
||||
<H3>Averages</H3>
|
||||
<P>The following are the average relative scores for all the tests: the perfect
|
||||
regular expression library would score 1, in practice anything less than 2
|
||||
is pretty good.</P>
|
||||
<P>%averages%</P>
|
||||
<h3>Comparison 1: Long Search</h3>
|
||||
<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
|
||||
|
@ -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
|
||||
// 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 stlport::isspace;
|
||||
# define BOOST_REGEX_STD
|
||||
#else
|
||||
# define BOOST_REGEX_STD std::
|
||||
|
12
test/Jamfile
12
test/Jamfile
@ -58,6 +58,18 @@ test-suite regex
|
||||
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
|
||||
]
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
@ -42,11 +42,11 @@ int test_main( int argc, char* argv[] )
|
||||
BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e1), std::runtime_error);
|
||||
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_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error);
|
||||
BOOST_CHECK(boost::regex_search(good_text, what, e2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user