Added new experimental captures support.

[SVN r21243]
This commit is contained in:
John Maddock
2003-12-13 12:28:48 +00:00
parent 6b95ac002e
commit bf9350aa16
28 changed files with 1593 additions and 612 deletions

250
doc/Attic/captures.html Normal file
View File

@ -0,0 +1,250 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Boost.Regex: Index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<body>
<P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<TD width="353">
<H1 align="center">Boost.Regex</H1>
<H2 align="center">Understanding Captures</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>
<H2>Marked sub-expressions</H2>
<P>Every time a Perl regular expression contains a parenthesis group (), it spits
out an extra field, known as a marked sub-expression, for example the
expression:</P>
<PRE>(\w+)\W+(\w+)</PRE>
<P>
Has two marked sub-expressions (known as $1 and $2 respectively), in addition
the complete match is known as $&amp;, everything before the first match as $`,
and everything after the match as $'.&nbsp; So if the above expression is
searched for within "@abc def--", then we obtain:</P>
<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<P>
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD>
<P dir="ltr" style="MARGIN-RIGHT: 0px">$`</P>
</TD>
<TD>"@"</TD>
</TR>
<TR>
<TD>$&amp;</TD>
<TD>"abc def"</TD>
</TR>
<TR>
<TD>$1</TD>
<TD>"abc"</TD>
</TR>
<TR>
<TD>$2</TD>
<TD>"def"</TD>
</TR>
<TR>
<TD>$'</TD>
<TD>"--"</TD>
</TR>
</TABLE>
</P>
</BLOCKQUOTE>
<P>In Boost.regex all these are accessible via the <A href="match_results.html">match_results</A>
class that gets filled in when calling one of the matching algorithms (<A href="regex_search.html">regex_search</A>,
<A href="regex_match.html">regex_match</A>, or <A href="regex_iterator.html">regex_iterator</A>).&nbsp;
So given:</P>
<PRE>boost::match_results&lt;IteratorType&gt; m;</PRE>
<P>The Perl and Boost.Regex equivalents are as follows:</P>
<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<P>
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD><STRONG>Perl</STRONG></TD>
<TD><STRONG>Boost.Regex</STRONG></TD>
</TR>
<TR>
<TD>$`</TD>
<TD>m.prefix()</TD>
</TR>
<TR>
<TD>$&amp;</TD>
<TD>m[0]</TD>
</TR>
<TR>
<TD>$n</TD>
<TD>m[n]</TD>
</TR>
<TR>
<TD>$'</TD>
<TD>m.suffix()</TD>
</TR>
</TABLE>
</P>
</BLOCKQUOTE>
<P>
<P>In Boost.Regex each sub-expression match is represented by a <A href="sub_match.html">
sub_match</A> object, this is basically just a pair of iterators denoting
the start and end possition of the sub-expression match, but there are some
additional operators provided so that objects of type sub_match behave a lot
like a std::basic_string: for example they are implicitly <A href="sub_match.html#m3">
convertible to a basic_string</A>, they can be <A href="sub_match.html#o21">compared
to a string</A>, <A href="sub_match.html#o81">added to a string</A>, or <A href="sub_match.html#oi">
streamed out to an output stream</A>.</P>
<H2>Unmatched Sub-Expressions</H2>
<P>When a regular expression match is found there is no need for all of the marked
sub-expressions to have participated in the match, for example the expression:</P>
<P>(abc)|(def)</P>
<P>can match either $1 or $2, but never both at the same time.&nbsp; In
Boost.Regex you can determine which sub-expressions matched by accessing the <A href="sub_match.html#m1">
sub_match::matched</A> data member.</P>
<H2>Repeated Captures</H2>
<P>When a marked sub-expression is repeated, then the sub-expression gets
"captured" multiple times, however normally only the final capture is
available, for example if</P>
<PRE>(?:(\w+)\W+)+</PRE>
<P>is matched against</P>
<PRE>one fine day</PRE>
<P>Then $1 will contain the string "day", and all the previous captures will have
been forgotten.</P>
<P>However, Boost.Regex has an experimental feature that allows all the capture
information to be retained - this is accessed either via the <A href="match_results.html#m17">
match_results::captures</A> member function or the <A href="sub_match.html#m8">sub_match::captures</A>
member function.&nbsp; These functions return a container that contains a
sequence of all the captures obtained during the regular expression
matching.&nbsp; The following example program shows how this information may be
used:</P>
<PRE>#include &lt;boost/regex.hpp&gt;
#include &lt;iostream&gt;
void print_captures(const std::string&amp; regx, const std::string&amp; text)
{
boost::regex e(regx);
boost::smatch what;
std::cout &lt;&lt; "Expression: \"" &lt;&lt; regx &lt;&lt; "\"\n";
std::cout &lt;&lt; "Text: \"" &lt;&lt; text &lt;&lt; "\"\n";
if(boost::regex_match(text, what, e, boost::match_extra))
{
unsigned i, j;
std::cout &lt;&lt; "** Match found **\n Sub-Expressions:\n";
for(i = 0; i &lt; what.size(); ++i)
std::cout &lt;&lt; " $" &lt;&lt; i &lt;&lt; " = \"" &lt;&lt; what[i] &lt;&lt; "\"\n";
std::cout &lt;&lt; " Captures:\n";
for(i = 0; i &lt; what.size(); ++i)
{
std::cout &lt;&lt; " $" &lt;&lt; i &lt;&lt; " = {";
for(j = 0; j &lt; what.captures(i).size(); ++j)
{
if(j)
std::cout &lt;&lt; ", ";
else
std::cout &lt;&lt; " ";
std::cout &lt;&lt; "\"" &lt;&lt; what.captures(i)[j] &lt;&lt; "\"";
}
std::cout &lt;&lt; " }\n";
}
}
else
{
std::cout &lt;&lt; "** No Match found **\n";
}
}
int main(int , char* [])
{
print_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDDeeeeeeee");
print_captures("(.*)bar|(.*)bah", "abcbar");
print_captures("(.*)bar|(.*)bah", "abcbah");
print_captures("^(?:(\\w+)|(?&gt;\\W+))*$", "now is the time for all good men to come to the aid of the party");
return 0;
}</PRE>
<P>Which produces the following output:</P>
<PRE>Expression: "(([[:lower:]]+)|([[:upper:]]+))+"
Text: "aBBcccDDDDDeeeeeeee"
** Match found **
Sub-Expressions:
$0 = "aBBcccDDDDDeeeeeeee"
$1 = "eeeeeeee"
$2 = "eeeeeeee"
$3 = "DDDDD"
Captures:
$0 = { "aBBcccDDDDDeeeeeeee" }
$1 = { "a", "BB", "ccc", "DDDDD", "eeeeeeee" }
$2 = { "a", "ccc", "eeeeeeee" }
$3 = { "BB", "DDDDD" }
Expression: "(.*)bar|(.*)bah"
Text: "abcbar"
** Match found **
Sub-Expressions:
$0 = "abcbar"
$1 = "abc"
$2 = ""
Captures:
$0 = { "abcbar" }
$1 = { "abc" }
$2 = { }
Expression: "(.*)bar|(.*)bah"
Text: "abcbah"
** Match found **
Sub-Expressions:
$0 = "abcbah"
$1 = ""
$2 = "abc"
Captures:
$0 = { "abcbah" }
$1 = { }
$2 = { "abc" }
Expression: "^(?:(\w+)|(?&gt;\W+))*$"
Text: "now is the time for all good men to come to the aid of the party"
** Match found **
Sub-Expressions:
$0 = "now is the time for all good men to come to the aid of the party"
$1 = "party"
Captures:
$0 = { "now is the time for all good men to come to the aid of the party" }
$1 = { "now", "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the", "party" }
</PRE>
<P>Unfortunately enabling this feature has an impact on performance (even if you
don't use it), and a much bigger impact if you do use it, therefore to use this
feature you need to:</P>
<UL>
<LI>
Define BOOST_REGEX_MATCH_EXTRA for all translation units including the library
source (the best way to do this is to uncomment this define in <A href="../../../boost/regex/user.hpp">
boost/regex/user.hpp</A>
and then rebuild everything.
<LI>
Pass the <A href="match_flag_type.html">match_extra flag</A> to the particular
algorithms where you actually need the captures information (<A href="regex_search.html">regex_search</A>,
<A href="regex_match.html">regex_match</A>, or <A href="regex_iterator.html">regex_iterator</A>).
</LI>
</UL>
<P>
<HR>
<P></P>
<P></P>
<p>Revised&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
12&nbsp;Dec 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -46,6 +46,7 @@ static const match_flag_type match_any;
static const match_flag_type match_not_null;
static const match_flag_type match_continuous;
static const match_flag_type match_partial;
static const match_flag_type match_single_line;
static const match_flag_type match_prev_avail;
static const match_flag_type match_not_dot_newline;
static const match_flag_type match_not_dot_null;
@ -167,6 +168,20 @@ static const match_flag_type format_all;
in a full match.</p>
</td>
</tr>
<TR>
<TD vAlign="top" width="50%">match_extra</TD>
<TD vAlign="top" width="50%">Instructs the matching engine to retain all available <A href="captures.html">
capture</A> information; if a capturing group is repeated then information
about every repeat is available via <A href="match_results.html#m17">match_results::captures()</A>
or <A href="sub_match.html#m8">sub_match_captures().</A></TD>
</TR>
<TR>
<TD vAlign="top" width="50%">match_single_line</TD>
<TD vAlign="top" width="50%">Equivalent to Perl's s/ modifier; prevents ^ from
matching after an embedded newline character (so that it only matches at the
start of the text being matched), and $ from matching before an embedded
newline (so that it only matches at the end of the text being matched).</TD>
</TR>
<tr>
<td valign="top" width="50%">
<p>match_prev_avail</p>
@ -259,8 +274,7 @@ static const match_flag_type format_all;
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>

View File

@ -2,23 +2,22 @@
<html>
<head>
<title>Boost.Regex: class match_results</title>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta content="HTML Tidy, see www.w3.org" name="generator">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
<body>
<p></p>
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<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 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">class match_results</h2>
</td>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
</td>
</tr>
</table>
@ -27,23 +26,23 @@
<hr>
<h3>Contents</h3>
<dl class="index">
<dt><a href="#synopsis">Synopsis</a> <dt><a href="#description">Description</a></dt>
<dt><A href="#synopsis">Synopsis</A> <dt><A href="#description">Description</A> </dt>
</dl>
<h3><a name="synopsis"></a>Synopsis</h3>
<p>#include &lt;<a href="../../../boost/regex.hpp">boost/regex.hpp</a>&gt;</p>
<p>#include &lt;<A href="../../../boost/regex.hpp">boost/regex.hpp</A>&gt;</p>
<p>Regular expressions are different from many simple pattern-matching algorithms
in that as well as finding an overall match they can also produce
sub-expression matches: each sub-expression being delimited in the pattern by a
pair of parenthesis (...). There has to be some method for reporting
sub-expression matches back to the user: this is achieved this by defining a
class <i>match_results</i> that acts as an indexed collection of sub-expression
matches, each sub-expression match being contained in an object of type <i><a href="sub_match.html">
sub_match</a></i> .</p>
matches, each sub-expression match being contained in an object of type <i><A href="sub_match.html">
sub_match</A></i> .</p>
<p>Template class match_results denotes a collection of character sequences
representing the result of a regular expression match. Objects of type
match_results are passed to the algorithms <a href="regex_match.html">regex_match</a>
and <a href="regex_search.html">regex_search</a>, and are returned by the
iterator <a href="regex_iterator.html">regex_iterator</a> .&nbsp; Storage for
match_results are passed to the algorithms <A href="regex_match.html">regex_match</A>
and <A href="regex_search.html">regex_search</A>, and are returned by the
iterator <A href="regex_iterator.html">regex_iterator</A> .&nbsp; Storage for
the collection is allocated and freed as necessary by the member functions of
class match_results.</p>
<p>The template class match_results conforms to the requirements of a Sequence, as
@ -51,8 +50,7 @@
const-qualified Sequences are supported.</p>
<p>Class template match_results is most commonly used as one of the typedefs
cmatch, wcmatch, smatch, or wsmatch:</p>
<pre>
template &lt;class BidirectionalIterator,
<pre>template &lt;class BidirectionalIterator,
class Allocator = allocator&lt;sub_match&lt;BidirectionalIterator&gt; &gt;
class match_results;
@ -78,52 +76,58 @@ public:
typedef basic_string&lt;char_type&gt; string_type;
// construct/copy/destroy:
explicit <A href="#c1">match_results</A>(const Allocator&amp; a = Allocator());
<A href="#c2">match_results</A>(const match_results&amp; m);
<A href="#c3">match_results</A>&amp; <A href="#c3">operator</A>=(const match_results&amp; m);
explicit <A href="#c1" >match_results</A>(const Allocator&amp; a = Allocator());
<A href="#c2" >match_results</A>(const match_results&amp; m);
<A href="#c3" >match_results</A>&amp; <A href="#c3" >operator</A>=(const match_results&amp; m);
~match_results();
// size:
size_type <A href="#m1">size</A>() const;
size_type <A href="#m2">max_size</A>() const;
bool <A href="#m3">empty</A>() const;
size_type <A href="#m1" >size</A>() const;
size_type <A href="#m2" >max_size</A>() const;
bool <A href="#m3" >empty</A>() const;
// element access:
difference_type <A href="#m4">length</A>(int sub = 0) const;
difference_type <A href="#m5">position</A>(unsigned int sub = 0) const;
string_type <A href="#m6">str</A>(int sub = 0) const;
const_reference <A href="#m7">operator</A>[](int n) const;
difference_type <A href="#m4" >length</A>(int sub = 0) const;
difference_type <A href="#m5" >position</A>(unsigned int sub = 0) const;
string_type <A href="#m6" >str</A>(int sub = 0) const;
const_reference <A href="#m7" >operator</A>[](int n) const;
const_reference <A href="#m8">prefix</A>() const;
const_reference <A href="#m8" >prefix</A>() const;
const_reference <A href="#m9">suffix</A>() const;
const_iterator <A href="#m10">begin</A>() const;
const_iterator <A href="#m11">end</A>() const;
const_reference <A href="#m9" >suffix</A>() const;
const_iterator <A href="#m10" >begin</A>() const;
const_iterator <A href="#m11" >end</A>() const;
// format:
template &lt;class OutputIterator&gt;
OutputIterator <A href="#m12">format</A>(OutputIterator out,
OutputIterator <A href="#m12" >format</A>(OutputIterator out,
const string_type&amp; fmt,
match_flag_type flags = format_default) const;
string_type <A href="#m13">format</A>(const string_type&amp; fmt,
string_type <A href="#m13" >format</A>(const string_type&amp; fmt,
match_flag_type flags = format_default) const;
allocator_type <A href="#m14">get_allocator</A>() const;
void <A href="#m15">swap</A>(match_results&amp; that);
allocator_type <A href="#m14" >get_allocator</A>() const;
void <A href="#m15" >swap</A>(match_results&amp; that);
#ifdef BOOST_REGEX_MATCH_EXTRA
typedef typename value_type::capture_sequence_type <A href="#m16" >capture_sequence_type</A>;
const capture_sequence_type&amp; <A href="#m17" >captures</A>(std::size_t i)const;
#endif
};
template &lt;class BidirectionalIterator, class Allocator&gt;
bool <A href="#n1">operator</A> == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
bool <A href="#n1" >operator</A> == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
template &lt;class BidirectionalIterator, class Allocator&gt;
bool <A href="#n2">operator</A> != (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
bool <A href="#n2" >operator</A> != (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
template &lt;class charT, class traits, class BidirectionalIterator, class Allocator&gt;
basic_ostream&lt;charT, traits&gt;&amp;
<A href="#n3">operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
<A href="#n3" >operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m);
template &lt;class BidirectionalIterator, class Allocator&gt;
void <A href="#n4">swap</A>(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
void <A href="#n4" >swap</A>(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
</pre>
<h3><a name="description"></a>Description</h3>
@ -139,42 +143,41 @@ match_results(const Allocator&amp; a = Allocator());
of this function are indicated in the table:</p>
<p align="center"></p>
<center>
<table id="Table2" cellspacing="1" cellpadding="7" width="624" border="1">
<table id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
<tbody>
<tr>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Element</b></p>
</td>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Value</b></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>empty()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>true</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>size()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>0</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>str()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>basic_string&lt;charT&gt;()</p>
</td>
</tr>
</tbody>
</table>
</tbody></table>
</center>
<p>&nbsp;</p>
<pre><A name=c2></A>
@ -190,82 +193,81 @@ match_results&amp; operator=(const match_results&amp; m);
indicated in the table:</p>
<p align="center"></p>
<center>
<table id="Table3" cellspacing="1" cellpadding="7" width="624" border="1">
<table id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
<tbody>
<tr>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Element</b></p>
</td>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Value</b></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>empty()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.empty().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>size()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>str(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.str(n) for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>prefix()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.prefix().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>suffix()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.suffix().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>(*this)[n]</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m[n] for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>length(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.length(n) for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>position(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.position(n) for all integers n &lt; m.size().</p>
</td>
</tr>
</tbody>
</table>
</tbody></table>
</center>
<h4>match_results size</h4>
<pre><A name=m1></A>
@ -342,11 +344,10 @@ const_iterator end()const;
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
marked sub-expression matches stored in *this.</p>
<h4><A name="format"></A>match_results reformatting</h4>
<pre><A name=m12></A>
template &lt;class OutputIterator&gt;
<pre>template &lt;class OutputIterator&gt;
OutputIterator format(OutputIterator out,
const string_type&amp; fmt,
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
<A href="match_flag_type.html" >match_flag_type</A> flags = format_default);
</pre>
<b></b>
<p><b>Requires:</b> The type OutputIterator conforms to the Output Iterator
@ -356,34 +357,34 @@ OutputIterator format(OutputIterator out,
OutputIterator <i>out</i>. For each format specifier or escape sequence in <i>fmt</i>,
replace that sequence with either the character(s) it represents, or the
sequence of characters within *this to which it refers. The bitmasks specified
in <i><a href="match_flag_type.html">flags</a></i> determines what <a href="format_syntax.html">
format specifiers or escape sequences are recognized</a>, by default this is
in <i><A href="match_flag_type.html">flags</A></i> determines what <A href="format_syntax.html">
format specifiers or escape sequences are recognized</A>, by default this is
the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part
5.4.11 String.prototype.replace.</p>
<b></b>
<p><b>Returns:</b> <i>out</i>.</p>
<pre><A name=m13></A>
string_type format(const string_type&amp; fmt,
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
<A href="match_flag_type.html" >match_flag_type</A> flags = format_default);
</pre>
<b></b>
<p><b>Effects:</b> Returns a copy of the string <i>fmt</i>. For each format
specifier or escape sequence in <i>fmt</i>, replace that sequence with either
the character(s) it represents, or the sequence of characters within *this to
which it refers. The bitmasks specified in <i><a href="match_flag_type.html">flags</a></i>
determines what <a href="format_syntax.html">format specifiers or escape sequences
are recognized</a>, by default this is the format used by ECMA-262,
which it refers. The bitmasks specified in <i><A href="match_flag_type.html">flags</A></i>
determines what <A href="format_syntax.html">format specifiers or escape sequences
are recognized</A>, by default this is the format used by ECMA-262,
ECMAScript Language Specification, Chapter 15 part 5.4.11
String.prototype.replace.</p>
<pre><A name=m14></A>
allocator_type get_allocator()const;
<H4>Allocator access</H4>
<pre>allocator_type get_allocator()const;
</pre>
<b></b>
<p><b>Effects:</b> Returns a copy of the Allocator that was passed to the object's
constructor.</p>
<pre><A name=m15></A>
void swap(match_results&amp; that);
</pre>
<H4><A name="m15"></A>Swap</H4>
<PRE>void swap(match_results&amp; that);
</PRE>
<b></b>
<p><b>Effects:</b> Swaps the contents of the two sequences.</p>
<b></b>
@ -392,6 +393,36 @@ void swap(match_results&amp; that);
sequence of matched sub-expressions that were in <code>*this</code>.</p>
<b></b>
<p><b>Complexity:</b> constant time.</p>
<H4>Captures</H4>
<PRE><A name=m16></A>typedef typename value_type::capture_sequence_type capture_sequence_type;</PRE>
<P>Defines an implementation-specific type that&nbsp;satisfies the requirements of
a standard library Sequence (21.1.1 including the optional Table 68
operations),&nbsp;whose value_type is a <EM>sub_match&lt;BidirectionalIterator&gt;</EM>.&nbsp;This
type happens to be <EM>std::vector&lt;sub_match&lt;BidirectionalIterator&gt; &gt;</EM>,
but you shouldn't actually rely on that.</P>
<PRE><A name=m17></A>const capture_sequence_type&amp; <A href="#m8" >captures</A>(std::size_t i)const; </PRE>
<P><STRONG>Effects:</STRONG> returns a sequence containing all the captures
obtained for sub-expression <EM>i</EM>.</P>
<P><STRONG>Returns:</STRONG> <code>(*this)[i].captures();</code></P>
<P><STRONG>Preconditions:</STRONG> the library must be built and used with
BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag <A href="match_flag_type.html">
match_extra</A> to the regex matching functions (<A href="regex_match.html">regex_match</A>,
<A href="regex_search.html">regex_search</A>, <A href="regex_iterator.html">regex_iterator</A>
or <A href="regex_token_iterator.html">regex_token_iterator</A>) in order for
this member function to be defined and return useful information.</P>
<P><STRONG>Rationale:</STRONG> Enabling this feature has several consequences:
</P>
<UL>
<LI>
sub_match occupies more memory resulting in complex expressions running out of
memory or stack space more quickly during matching.
<LI>
The matching algorithms are less efficient at handling some features
(independent sub-expressions for example), even when match_extra is not used.
<LI>
The matching algorithms are much less efficient (i.e. slower), when match_extra
is used.&nbsp; Mostly this is down to the extra memory allocations that have to
take place.</LI></UL>
<h4>match_results non-members</h4>
<PRE><A name=n1></A>template &lt;class BidirectionalIterator, class Allocator&gt;
bool operator == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
@ -418,10 +449,10 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -3,21 +3,20 @@
<head>
<title>Boost.Regex: sub_match</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
<body>
<P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
<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">sub_match</H2>
</TD>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
</td>
</TR>
</TABLE>
@ -41,20 +40,28 @@
<P>Objects of type <EM>sub_match</EM> may be compared to objects of type <EM>std::basic_string</EM>,
or <EM>const charT*</EM> or <EM>const charT</EM>
.
<P>Objects of type <EM>sub_match</EM> may be added to objects of type <EM>std::basic_string</EM>,
or <EM>const charT* </EM>or <EM>const charT</EM>, to produce a new <EM>std::basic_string
</EM>
object.
<P>When the marked sub-expression denoted by an object of type sub_match&lt;&gt;
participated in a regular expression match then member <CODE>matched</CODE> evaluates
to true, and members <CODE>first</CODE> and <CODE>second</CODE> denote the
range of characters <CODE>[first,second)</CODE> which formed that match.
Otherwise <CODE>matched</CODE> is false, and members <CODE>first</CODE> and <CODE>second</CODE>
contained undefined values.</P>
<P>When the marked sub-expression denoted by an object of type sub_match&lt;&gt;
was repeated, then the sub_match object represents the match obtained by the
last repeat.&nbsp; The complete set of all the captures obtained for all the
repeats, may be accessed via the captures() member function (Note: this has
serious performance implications, you have to explicitly enable this feature).</P>
<P>If an object of type <CODE>sub_match&lt;&gt;</CODE> represents sub-expression 0
- that is to say the whole match - then member <CODE>matched</CODE> is always
true, unless a partial match was obtained as a result of the flag <CODE>match_partial</CODE>
being passed to a regular expression algorithm, in which case member <CODE>matched</CODE>
is false, and members <CODE>first</CODE> and <CODE>second</CODE> represent the
character range that formed the partial match.</P>
<PRE>
namespace boost{
<PRE>namespace boost{
template &lt;class BidirectionalIterator&gt;
class sub_match : public std::pair&lt;BidirectionalIterator, BidirectionalIterator&gt;
@ -64,36 +71,40 @@ public:
typedef typename iterator_traits&lt;BidirectionalIterator&gt;::difference_type difference_type;
typedef BidirectionalIterator iterator;
bool <A href="#m1">matched</A>;
bool <A href="#m1" >matched</A>;
difference_type <A href="#m2">length</A>()const;
operator <A href="#m3">basic_string</A>&lt;value_type&gt;()const;
basic_string&lt;value_type&gt; <A href="#m4">str</A>()const;
difference_type <A href="#m2" >length</A>()const;
operator <A href="#m3" >basic_string</A>&lt;value_type&gt;()const;
basic_string&lt;value_type&gt; <A href="#m4" >str</A>()const;
int <A href="#m5">compare</A>(const sub_match&amp; s)const;
int <A href="#m6">compare</A>(const basic_string&lt;value_type&gt;&amp; s)const;
int <A href="#m7">compare</A>(const value_type* s)const;
int <A href="#m5" >compare</A>(const sub_match&amp; s)const;
int <A href="#m6" >compare</A>(const basic_string&lt;value_type&gt;&amp; s)const;
int <A href="#m7" >compare</A>(const value_type* s)const;
#ifdef BOOST_REGEX_MATCH_EXTRA
typedef implementation-private <A href="#m9">capture_sequence_type</A>;
const capture_sequence_type&amp; <A href="#m8" >captures</A>()const;
#endif
};
//
// comparisons to another sub_match:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o11">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o11" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o12">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o12" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o13">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o13" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o14">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o14" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o15">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o15" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o16">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o16" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
@ -101,166 +112,165 @@ bool <A href="#o16">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&
// comparisons to a basic_string:
//
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o21">operator</A> == (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o21" >operator</A> == (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o22">operator</A> != (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o22" >operator</A> != (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o23">operator</A> &lt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o23" >operator</A> &lt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o24">operator</A> &gt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o24" >operator</A> &gt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o25">operator</A> &gt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o25" >operator</A> &gt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o26">operator</A> &lt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o26" >operator</A> &lt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o31">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o31" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o32">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o32" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o33">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o33" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o34">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o34" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o35">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o35" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o36">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o36" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
//
// comparisons to a pointer to a character array:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o41">operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o41" >operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o42">operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o42" >operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o43">operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o43" >operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o44">operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o44" >operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o45">operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o45" >operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o46">operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o46" >operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o51">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o51" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o52">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o52" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o53">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o53" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o54">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o54" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o55">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o55" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o56">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o56" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
//
// comparisons to a single character:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o61">operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o61" >operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o62">operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o62" >operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o63">operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o63" >operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o64">operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o64" >operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o65">operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o65" >operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o66">operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o66" >operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o71">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o71" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o72">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o72" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o73">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o73" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o74">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o74" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o75">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o75" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o76">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o76" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
//
// addition operators:
//
template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o81">operator</A> + (const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o82">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s);
template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o83">operator</A> + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const* s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o84">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const * s);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o85">operator</A> + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o86">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o87">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m1,
const sub_match&lt;RandomAccessIterator&gt;&amp; m2);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o81" >operator</A> + (const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o82" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s);
template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o83" >operator</A> + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o84" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const * s);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o85" >operator</A> + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o86" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o87" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m1,
const sub_match&lt;BidirectionalIterator&gt;&amp; m2);
//
// stream inserter:
//
template &lt;class charT, class traits, class BidirectionalIterator&gt;
basic_ostream&lt;charT, traits&gt;&amp;
<A href="#oi">operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
<A href="#oi" >operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
} // namespace boost</PRE>
<H3>Description</H3>
<H4>
sub_match members</H4>
<H4>sub_match members</H4>
<PRE>typedef typename std::iterator_traits&lt;iterator&gt;::value_type value_type;</PRE>
<P>The type pointed to by the iterators.</P>
<PRE>typedef typename std::iterator_traits&lt;iterator&gt;::difference_type difference_type;</PRE>
@ -274,59 +284,77 @@ basic_ostream&lt;charT, traits&gt;&amp;
<PRE><A name=m1></A>bool matched</PRE>
<P>A Boolean value denoting whether this sub-expression participated in the match.</P>
<PRE><A name=m2></A>static difference_type length();</PRE>
<P>
<B>Effects: </B>returns the length of this matched sub-expression, or 0 if this
<P><B>Effects: </B>returns the length of this matched sub-expression, or 0 if this
sub-expression was not matched: <CODE>matched ? distance(first, second) : 0)</CODE>.</P>
<PRE><A name=m3></A>operator basic_string&lt;value_type&gt;()const;</PRE>
<P>
<B>Effects: </B>converts *this into a string: returns <CODE>(matched ?
<P><B>Effects: </B>converts *this into a string: returns <CODE>(matched ?
basic_string&lt;value_type&gt;(first, second) :
basic_string&lt;value_type&gt;()).</P>
</CODE><PRE><A name=m4></A>basic_string&lt;value_type&gt; str()const;</PRE>
<P><B> Effects: </B>returns a string representation of *this:&nbsp; <CODE>(matched ?
<P><B>Effects: </B>returns a string representation of *this:&nbsp; <CODE>(matched ?
basic_string&lt;value_type&gt;(first, second) :
basic_string&lt;value_type&gt;())</CODE>.</P>
<PRE><A name=m5></A>int compare(const sub_match&amp; s)const;</PRE>
<P>
<B>Effects: </B>performs a lexical comparison to <EM>s</EM>: returns <CODE>str().compare(s.str())</CODE>.</P>
<P><B>Effects: </B>performs a lexical comparison to <EM>s</EM>: returns <CODE>str().compare(s.str())</CODE>.</P>
<PRE><A name=m6></A>int compare(const basic_string&lt;value_type&gt;&amp; s)const;</PRE>
<P><B> Effects: </B>compares *this to the string s: returns <CODE>str().compare(s)</CODE>.</P>
<P><B>Effects: </B>compares *this to the string s: returns <CODE>str().compare(s)</CODE>.</P>
<PRE><A name=m7></A>int compare(const value_type* s)const;</PRE>
<P>
<B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B>&nbsp;</B>returns
<P><B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B>&nbsp;</B>returns
<CODE>str().compare(s)</CODE>.</P>
<H4>
sub_match non-member operators</H4>
<PRE><A name=m9></A>typedef implementation-private capture_sequence_type;</PRE>
<P>Defines an implementation-specific type that&nbsp;satisfies the requirements of
a standard library Sequence (21.1.1 including the optional Table 68
operations),&nbsp;whose value_type is a <EM>sub_match&lt;BidirectionalIterator&gt;</EM>.&nbsp;This
type happens to be <EM>std::vector&lt;sub_match&lt;BidirectionalIterator&gt; &gt;</EM>,
but you shouldn't actually rely on that.</P>
<PRE><A name=m8></A>const capture_sequence_type&amp; <A href="#m8" >captures</A>()const; </PRE>
<P><STRONG>Effects:</STRONG> returns a sequence containing all the captures
obtained for this sub-expression.</P>
<P><STRONG>Preconditions:</STRONG> the library must be built and used with
BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag <A href="match_flag_type.html">
match_extra</A> to the regex matching functions (<A href="regex_match.html">regex_match</A>,
<A href="regex_search.html">regex_search</A>, <A href="regex_iterator.html">regex_iterator</A>
or <A href="regex_token_iterator.html">regex_token_iterator</A>) in order for
this member function to be defined and return useful information.</P>
<P><STRONG>Rationale:</STRONG> Enabling this feature has several consequences:
</P>
<UL>
<LI>
sub_match occupies more memory resulting in complex expressions running out of
memory or stack space more quickly during matching.
<LI>
The matching algorithms are less efficient at handling some features
(independent sub-expressions for example), even when match_extra is not used.
<LI>
The matching algorithms are much less efficient (i.e. slower), when match_extra
is used.&nbsp; Mostly this is down to the extra memory allocations that have to
take place.</LI></UL>
<H4>sub_match non-member operators</H4>
<H5>Comparisons against self</H5>
<PRE><A name=o11></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) == 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) == 0</CODE>.</P>
<PRE><A name=o12></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) != 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) != 0</CODE>.</P>
<PRE><A name=o13></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt; 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt; 0</CODE>.</P>
<PRE><A name=o14></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P><B> Effects: </B>returns <CODE>lhs.compare(rhs) &lt;= 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt;= 0</CODE>.</P>
<PRE><A name=o15></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt;= 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt;= 0</CODE>.</P>
<PRE><A name=o16></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt; 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt; 0</CODE>.</P>
<H5>Comparisons with std::basic_string</H5>
<pre><A name=o21></A>
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
@ -382,159 +410,135 @@ bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
<PRE><A name=o41></A>template &lt;class BidirectionalIterator&gt;
bool operator == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<PRE><A name=o42></A>template &lt;class BidirectionalIterator&gt;
bool operator != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<PRE></A><A name=o43></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<PRE><A name=o44></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<PRE><A name=o45></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<PRE><A name=o46></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<PRE><A name=o51></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<PRE><A name=o52></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<PRE><A name=o53></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<PRE><A name=o54></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<PRE><A name=o55></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<PRE><A name=o56></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<H5>Comparisons with a single character</H5>
<PRE><A name=o61></A>template &lt;class BidirectionalIterator&gt;
bool operator == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<PRE><A name=o62></A>template &lt;class BidirectionalIterator&gt;
bool operator != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<PRE><A name=o63></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<PRE><A name=o64></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<PRE><A name=o65></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<PRE><A name=o66></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<PRE><A name=o71></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<PRE><A name=o72></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<PRE><A name=o73></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<PRE><A name=o74></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<PRE><A name=o75></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<PRE><A name=o76></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<h5>Addition operators</h5>
<P>The addition operators for sub_match allow you to add a sub_match to any type
to which you can add a std::string and obtain a new string as the result.</P>
<PRE><A name=o81></A>template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
operator + (const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o81></A>template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
operator + (const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o82></A>template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s); </PRE>
<PRE><A name=o82></A>template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s); </PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o83></A>template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const* s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o83></A>template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o84></A>template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const * s);</PRE>
<PRE><A name=o84></A>template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const * s);</PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o85></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o85></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o86></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s); </PRE>
<PRE><A name=o86></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s); </PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o87></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m1,
const sub_match&lt;RandomAccessIterator&gt;&amp; m2);</PRE>
<PRE><A name=o87></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m1,
const sub_match&lt;BidirectionalIterator&gt;&amp; m2);</PRE>
<P><B>Effects: </B>returns&nbsp;<CODE>m1.str() + m2.str()</CODE>.</P>
<h5>Stream inserter</h5>
<PRE><A name=oi></A>template &lt;class charT, class traits, class BidirectionalIterator&gt;
@ -549,10 +553,10 @@ basic_ostream&lt;charT, traits&gt;&amp;
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

250
doc/captures.html Normal file
View File

@ -0,0 +1,250 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Boost.Regex: Index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<body>
<P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
</td>
<TD width="353">
<H1 align="center">Boost.Regex</H1>
<H2 align="center">Understanding Captures</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>
<H2>Marked sub-expressions</H2>
<P>Every time a Perl regular expression contains a parenthesis group (), it spits
out an extra field, known as a marked sub-expression, for example the
expression:</P>
<PRE>(\w+)\W+(\w+)</PRE>
<P>
Has two marked sub-expressions (known as $1 and $2 respectively), in addition
the complete match is known as $&amp;, everything before the first match as $`,
and everything after the match as $'.&nbsp; So if the above expression is
searched for within "@abc def--", then we obtain:</P>
<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<P>
<TABLE id="Table2" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD>
<P dir="ltr" style="MARGIN-RIGHT: 0px">$`</P>
</TD>
<TD>"@"</TD>
</TR>
<TR>
<TD>$&amp;</TD>
<TD>"abc def"</TD>
</TR>
<TR>
<TD>$1</TD>
<TD>"abc"</TD>
</TR>
<TR>
<TD>$2</TD>
<TD>"def"</TD>
</TR>
<TR>
<TD>$'</TD>
<TD>"--"</TD>
</TR>
</TABLE>
</P>
</BLOCKQUOTE>
<P>In Boost.regex all these are accessible via the <A href="match_results.html">match_results</A>
class that gets filled in when calling one of the matching algorithms (<A href="regex_search.html">regex_search</A>,
<A href="regex_match.html">regex_match</A>, or <A href="regex_iterator.html">regex_iterator</A>).&nbsp;
So given:</P>
<PRE>boost::match_results&lt;IteratorType&gt; m;</PRE>
<P>The Perl and Boost.Regex equivalents are as follows:</P>
<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<P>
<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD><STRONG>Perl</STRONG></TD>
<TD><STRONG>Boost.Regex</STRONG></TD>
</TR>
<TR>
<TD>$`</TD>
<TD>m.prefix()</TD>
</TR>
<TR>
<TD>$&amp;</TD>
<TD>m[0]</TD>
</TR>
<TR>
<TD>$n</TD>
<TD>m[n]</TD>
</TR>
<TR>
<TD>$'</TD>
<TD>m.suffix()</TD>
</TR>
</TABLE>
</P>
</BLOCKQUOTE>
<P>
<P>In Boost.Regex each sub-expression match is represented by a <A href="sub_match.html">
sub_match</A> object, this is basically just a pair of iterators denoting
the start and end possition of the sub-expression match, but there are some
additional operators provided so that objects of type sub_match behave a lot
like a std::basic_string: for example they are implicitly <A href="sub_match.html#m3">
convertible to a basic_string</A>, they can be <A href="sub_match.html#o21">compared
to a string</A>, <A href="sub_match.html#o81">added to a string</A>, or <A href="sub_match.html#oi">
streamed out to an output stream</A>.</P>
<H2>Unmatched Sub-Expressions</H2>
<P>When a regular expression match is found there is no need for all of the marked
sub-expressions to have participated in the match, for example the expression:</P>
<P>(abc)|(def)</P>
<P>can match either $1 or $2, but never both at the same time.&nbsp; In
Boost.Regex you can determine which sub-expressions matched by accessing the <A href="sub_match.html#m1">
sub_match::matched</A> data member.</P>
<H2>Repeated Captures</H2>
<P>When a marked sub-expression is repeated, then the sub-expression gets
"captured" multiple times, however normally only the final capture is
available, for example if</P>
<PRE>(?:(\w+)\W+)+</PRE>
<P>is matched against</P>
<PRE>one fine day</PRE>
<P>Then $1 will contain the string "day", and all the previous captures will have
been forgotten.</P>
<P>However, Boost.Regex has an experimental feature that allows all the capture
information to be retained - this is accessed either via the <A href="match_results.html#m17">
match_results::captures</A> member function or the <A href="sub_match.html#m8">sub_match::captures</A>
member function.&nbsp; These functions return a container that contains a
sequence of all the captures obtained during the regular expression
matching.&nbsp; The following example program shows how this information may be
used:</P>
<PRE>#include &lt;boost/regex.hpp&gt;
#include &lt;iostream&gt;
void print_captures(const std::string&amp; regx, const std::string&amp; text)
{
boost::regex e(regx);
boost::smatch what;
std::cout &lt;&lt; "Expression: \"" &lt;&lt; regx &lt;&lt; "\"\n";
std::cout &lt;&lt; "Text: \"" &lt;&lt; text &lt;&lt; "\"\n";
if(boost::regex_match(text, what, e, boost::match_extra))
{
unsigned i, j;
std::cout &lt;&lt; "** Match found **\n Sub-Expressions:\n";
for(i = 0; i &lt; what.size(); ++i)
std::cout &lt;&lt; " $" &lt;&lt; i &lt;&lt; " = \"" &lt;&lt; what[i] &lt;&lt; "\"\n";
std::cout &lt;&lt; " Captures:\n";
for(i = 0; i &lt; what.size(); ++i)
{
std::cout &lt;&lt; " $" &lt;&lt; i &lt;&lt; " = {";
for(j = 0; j &lt; what.captures(i).size(); ++j)
{
if(j)
std::cout &lt;&lt; ", ";
else
std::cout &lt;&lt; " ";
std::cout &lt;&lt; "\"" &lt;&lt; what.captures(i)[j] &lt;&lt; "\"";
}
std::cout &lt;&lt; " }\n";
}
}
else
{
std::cout &lt;&lt; "** No Match found **\n";
}
}
int main(int , char* [])
{
print_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDDeeeeeeee");
print_captures("(.*)bar|(.*)bah", "abcbar");
print_captures("(.*)bar|(.*)bah", "abcbah");
print_captures("^(?:(\\w+)|(?&gt;\\W+))*$", "now is the time for all good men to come to the aid of the party");
return 0;
}</PRE>
<P>Which produces the following output:</P>
<PRE>Expression: "(([[:lower:]]+)|([[:upper:]]+))+"
Text: "aBBcccDDDDDeeeeeeee"
** Match found **
Sub-Expressions:
$0 = "aBBcccDDDDDeeeeeeee"
$1 = "eeeeeeee"
$2 = "eeeeeeee"
$3 = "DDDDD"
Captures:
$0 = { "aBBcccDDDDDeeeeeeee" }
$1 = { "a", "BB", "ccc", "DDDDD", "eeeeeeee" }
$2 = { "a", "ccc", "eeeeeeee" }
$3 = { "BB", "DDDDD" }
Expression: "(.*)bar|(.*)bah"
Text: "abcbar"
** Match found **
Sub-Expressions:
$0 = "abcbar"
$1 = "abc"
$2 = ""
Captures:
$0 = { "abcbar" }
$1 = { "abc" }
$2 = { }
Expression: "(.*)bar|(.*)bah"
Text: "abcbah"
** Match found **
Sub-Expressions:
$0 = "abcbah"
$1 = ""
$2 = "abc"
Captures:
$0 = { "abcbah" }
$1 = { }
$2 = { "abc" }
Expression: "^(?:(\w+)|(?&gt;\W+))*$"
Text: "now is the time for all good men to come to the aid of the party"
** Match found **
Sub-Expressions:
$0 = "now is the time for all good men to come to the aid of the party"
$1 = "party"
Captures:
$0 = { "now is the time for all good men to come to the aid of the party" }
$1 = { "now", "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the", "party" }
</PRE>
<P>Unfortunately enabling this feature has an impact on performance (even if you
don't use it), and a much bigger impact if you do use it, therefore to use this
feature you need to:</P>
<UL>
<LI>
Define BOOST_REGEX_MATCH_EXTRA for all translation units including the library
source (the best way to do this is to uncomment this define in <A href="../../../boost/regex/user.hpp">
boost/regex/user.hpp</A>
and then rebuild everything.
<LI>
Pass the <A href="match_flag_type.html">match_extra flag</A> to the particular
algorithms where you actually need the captures information (<A href="regex_search.html">regex_search</A>,
<A href="regex_match.html">regex_match</A>, or <A href="regex_iterator.html">regex_iterator</A>).
</LI>
</UL>
<P>
<HR>
<P></P>
<P></P>
<p>Revised&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
12&nbsp;Dec 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -73,6 +73,7 @@
<dt><a href="partial_matches.html">Partial matches</a></dt>
<dt><a href="syntax.html">Regular Expression Syntax</a></dt>
<dt><a href="format_syntax.html">Format String Syntax</a></dt>
<dt><a href="captures.html">Understanding Captures</a></dt>
</dl>
</dd>
<dt>Deprecated interfaces</dt>

View File

@ -46,6 +46,7 @@ static const match_flag_type match_any;
static const match_flag_type match_not_null;
static const match_flag_type match_continuous;
static const match_flag_type match_partial;
static const match_flag_type match_single_line;
static const match_flag_type match_prev_avail;
static const match_flag_type match_not_dot_newline;
static const match_flag_type match_not_dot_null;
@ -167,6 +168,20 @@ static const match_flag_type format_all;
in a full match.</p>
</td>
</tr>
<TR>
<TD vAlign="top" width="50%">match_extra</TD>
<TD vAlign="top" width="50%">Instructs the matching engine to retain all available <A href="captures.html">
capture</A> information; if a capturing group is repeated then information
about every repeat is available via <A href="match_results.html#m17">match_results::captures()</A>
or <A href="sub_match.html#m8">sub_match_captures().</A></TD>
</TR>
<TR>
<TD vAlign="top" width="50%">match_single_line</TD>
<TD vAlign="top" width="50%">Equivalent to Perl's s/ modifier; prevents ^ from
matching after an embedded newline character (so that it only matches at the
start of the text being matched), and $ from matching before an embedded
newline (so that it only matches at the end of the text being matched).</TD>
</TR>
<tr>
<td valign="top" width="50%">
<p>match_prev_avail</p>
@ -259,8 +274,7 @@ static const match_flag_type format_all;
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>

View File

@ -2,23 +2,22 @@
<html>
<head>
<title>Boost.Regex: class match_results</title>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta content="HTML Tidy, see www.w3.org" name="generator">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
<body>
<p></p>
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<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 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">class match_results</h2>
</td>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
</td>
</tr>
</table>
@ -27,23 +26,23 @@
<hr>
<h3>Contents</h3>
<dl class="index">
<dt><a href="#synopsis">Synopsis</a> <dt><a href="#description">Description</a></dt>
<dt><A href="#synopsis">Synopsis</A> <dt><A href="#description">Description</A> </dt>
</dl>
<h3><a name="synopsis"></a>Synopsis</h3>
<p>#include &lt;<a href="../../../boost/regex.hpp">boost/regex.hpp</a>&gt;</p>
<p>#include &lt;<A href="../../../boost/regex.hpp">boost/regex.hpp</A>&gt;</p>
<p>Regular expressions are different from many simple pattern-matching algorithms
in that as well as finding an overall match they can also produce
sub-expression matches: each sub-expression being delimited in the pattern by a
pair of parenthesis (...). There has to be some method for reporting
sub-expression matches back to the user: this is achieved this by defining a
class <i>match_results</i> that acts as an indexed collection of sub-expression
matches, each sub-expression match being contained in an object of type <i><a href="sub_match.html">
sub_match</a></i> .</p>
matches, each sub-expression match being contained in an object of type <i><A href="sub_match.html">
sub_match</A></i> .</p>
<p>Template class match_results denotes a collection of character sequences
representing the result of a regular expression match. Objects of type
match_results are passed to the algorithms <a href="regex_match.html">regex_match</a>
and <a href="regex_search.html">regex_search</a>, and are returned by the
iterator <a href="regex_iterator.html">regex_iterator</a> .&nbsp; Storage for
match_results are passed to the algorithms <A href="regex_match.html">regex_match</A>
and <A href="regex_search.html">regex_search</A>, and are returned by the
iterator <A href="regex_iterator.html">regex_iterator</A> .&nbsp; Storage for
the collection is allocated and freed as necessary by the member functions of
class match_results.</p>
<p>The template class match_results conforms to the requirements of a Sequence, as
@ -51,8 +50,7 @@
const-qualified Sequences are supported.</p>
<p>Class template match_results is most commonly used as one of the typedefs
cmatch, wcmatch, smatch, or wsmatch:</p>
<pre>
template &lt;class BidirectionalIterator,
<pre>template &lt;class BidirectionalIterator,
class Allocator = allocator&lt;sub_match&lt;BidirectionalIterator&gt; &gt;
class match_results;
@ -78,52 +76,58 @@ public:
typedef basic_string&lt;char_type&gt; string_type;
// construct/copy/destroy:
explicit <A href="#c1">match_results</A>(const Allocator&amp; a = Allocator());
<A href="#c2">match_results</A>(const match_results&amp; m);
<A href="#c3">match_results</A>&amp; <A href="#c3">operator</A>=(const match_results&amp; m);
explicit <A href="#c1" >match_results</A>(const Allocator&amp; a = Allocator());
<A href="#c2" >match_results</A>(const match_results&amp; m);
<A href="#c3" >match_results</A>&amp; <A href="#c3" >operator</A>=(const match_results&amp; m);
~match_results();
// size:
size_type <A href="#m1">size</A>() const;
size_type <A href="#m2">max_size</A>() const;
bool <A href="#m3">empty</A>() const;
size_type <A href="#m1" >size</A>() const;
size_type <A href="#m2" >max_size</A>() const;
bool <A href="#m3" >empty</A>() const;
// element access:
difference_type <A href="#m4">length</A>(int sub = 0) const;
difference_type <A href="#m5">position</A>(unsigned int sub = 0) const;
string_type <A href="#m6">str</A>(int sub = 0) const;
const_reference <A href="#m7">operator</A>[](int n) const;
difference_type <A href="#m4" >length</A>(int sub = 0) const;
difference_type <A href="#m5" >position</A>(unsigned int sub = 0) const;
string_type <A href="#m6" >str</A>(int sub = 0) const;
const_reference <A href="#m7" >operator</A>[](int n) const;
const_reference <A href="#m8">prefix</A>() const;
const_reference <A href="#m8" >prefix</A>() const;
const_reference <A href="#m9">suffix</A>() const;
const_iterator <A href="#m10">begin</A>() const;
const_iterator <A href="#m11">end</A>() const;
const_reference <A href="#m9" >suffix</A>() const;
const_iterator <A href="#m10" >begin</A>() const;
const_iterator <A href="#m11" >end</A>() const;
// format:
template &lt;class OutputIterator&gt;
OutputIterator <A href="#m12">format</A>(OutputIterator out,
OutputIterator <A href="#m12" >format</A>(OutputIterator out,
const string_type&amp; fmt,
match_flag_type flags = format_default) const;
string_type <A href="#m13">format</A>(const string_type&amp; fmt,
string_type <A href="#m13" >format</A>(const string_type&amp; fmt,
match_flag_type flags = format_default) const;
allocator_type <A href="#m14">get_allocator</A>() const;
void <A href="#m15">swap</A>(match_results&amp; that);
allocator_type <A href="#m14" >get_allocator</A>() const;
void <A href="#m15" >swap</A>(match_results&amp; that);
#ifdef BOOST_REGEX_MATCH_EXTRA
typedef typename value_type::capture_sequence_type <A href="#m16" >capture_sequence_type</A>;
const capture_sequence_type&amp; <A href="#m17" >captures</A>(std::size_t i)const;
#endif
};
template &lt;class BidirectionalIterator, class Allocator&gt;
bool <A href="#n1">operator</A> == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
bool <A href="#n1" >operator</A> == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
template &lt;class BidirectionalIterator, class Allocator&gt;
bool <A href="#n2">operator</A> != (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
bool <A href="#n2" >operator</A> != (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
template &lt;class charT, class traits, class BidirectionalIterator, class Allocator&gt;
basic_ostream&lt;charT, traits&gt;&amp;
<A href="#n3">operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
<A href="#n3" >operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m);
template &lt;class BidirectionalIterator, class Allocator&gt;
void <A href="#n4">swap</A>(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
void <A href="#n4" >swap</A>(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m2);
</pre>
<h3><a name="description"></a>Description</h3>
@ -139,42 +143,41 @@ match_results(const Allocator&amp; a = Allocator());
of this function are indicated in the table:</p>
<p align="center"></p>
<center>
<table id="Table2" cellspacing="1" cellpadding="7" width="624" border="1">
<table id="Table2" cellSpacing="1" cellPadding="7" width="624" border="1">
<tbody>
<tr>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Element</b></p>
</td>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Value</b></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>empty()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>true</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>size()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>0</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>str()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>basic_string&lt;charT&gt;()</p>
</td>
</tr>
</tbody>
</table>
</tbody></table>
</center>
<p>&nbsp;</p>
<pre><A name=c2></A>
@ -190,82 +193,81 @@ match_results&amp; operator=(const match_results&amp; m);
indicated in the table:</p>
<p align="center"></p>
<center>
<table id="Table3" cellspacing="1" cellpadding="7" width="624" border="1">
<table id="Table3" cellSpacing="1" cellPadding="7" width="624" border="1">
<tbody>
<tr>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Element</b></p>
</td>
<td valign="top" width="50%"><b></b>
<td vAlign="top" width="50%"><b></b>
<p><b>Value</b></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>empty()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.empty().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>size()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>str(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.str(n) for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>prefix()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.prefix().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>suffix()</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.suffix().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>(*this)[n]</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m[n] for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>length(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.length(n) for all integers n &lt; m.size().</p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>position(n)</p>
</td>
<td valign="top" width="50%">
<td vAlign="top" width="50%">
<p>m.position(n) for all integers n &lt; m.size().</p>
</td>
</tr>
</tbody>
</table>
</tbody></table>
</center>
<h4>match_results size</h4>
<pre><A name=m1></A>
@ -342,11 +344,10 @@ const_iterator end()const;
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
marked sub-expression matches stored in *this.</p>
<h4><A name="format"></A>match_results reformatting</h4>
<pre><A name=m12></A>
template &lt;class OutputIterator&gt;
<pre>template &lt;class OutputIterator&gt;
OutputIterator format(OutputIterator out,
const string_type&amp; fmt,
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
<A href="match_flag_type.html" >match_flag_type</A> flags = format_default);
</pre>
<b></b>
<p><b>Requires:</b> The type OutputIterator conforms to the Output Iterator
@ -356,34 +357,34 @@ OutputIterator format(OutputIterator out,
OutputIterator <i>out</i>. For each format specifier or escape sequence in <i>fmt</i>,
replace that sequence with either the character(s) it represents, or the
sequence of characters within *this to which it refers. The bitmasks specified
in <i><a href="match_flag_type.html">flags</a></i> determines what <a href="format_syntax.html">
format specifiers or escape sequences are recognized</a>, by default this is
in <i><A href="match_flag_type.html">flags</A></i> determines what <A href="format_syntax.html">
format specifiers or escape sequences are recognized</A>, by default this is
the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part
5.4.11 String.prototype.replace.</p>
<b></b>
<p><b>Returns:</b> <i>out</i>.</p>
<pre><A name=m13></A>
string_type format(const string_type&amp; fmt,
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
<A href="match_flag_type.html" >match_flag_type</A> flags = format_default);
</pre>
<b></b>
<p><b>Effects:</b> Returns a copy of the string <i>fmt</i>. For each format
specifier or escape sequence in <i>fmt</i>, replace that sequence with either
the character(s) it represents, or the sequence of characters within *this to
which it refers. The bitmasks specified in <i><a href="match_flag_type.html">flags</a></i>
determines what <a href="format_syntax.html">format specifiers or escape sequences
are recognized</a>, by default this is the format used by ECMA-262,
which it refers. The bitmasks specified in <i><A href="match_flag_type.html">flags</A></i>
determines what <A href="format_syntax.html">format specifiers or escape sequences
are recognized</A>, by default this is the format used by ECMA-262,
ECMAScript Language Specification, Chapter 15 part 5.4.11
String.prototype.replace.</p>
<pre><A name=m14></A>
allocator_type get_allocator()const;
<H4>Allocator access</H4>
<pre>allocator_type get_allocator()const;
</pre>
<b></b>
<p><b>Effects:</b> Returns a copy of the Allocator that was passed to the object's
constructor.</p>
<pre><A name=m15></A>
void swap(match_results&amp; that);
</pre>
<H4><A name="m15"></A>Swap</H4>
<PRE>void swap(match_results&amp; that);
</PRE>
<b></b>
<p><b>Effects:</b> Swaps the contents of the two sequences.</p>
<b></b>
@ -392,6 +393,36 @@ void swap(match_results&amp; that);
sequence of matched sub-expressions that were in <code>*this</code>.</p>
<b></b>
<p><b>Complexity:</b> constant time.</p>
<H4>Captures</H4>
<PRE><A name=m16></A>typedef typename value_type::capture_sequence_type capture_sequence_type;</PRE>
<P>Defines an implementation-specific type that&nbsp;satisfies the requirements of
a standard library Sequence (21.1.1 including the optional Table 68
operations),&nbsp;whose value_type is a <EM>sub_match&lt;BidirectionalIterator&gt;</EM>.&nbsp;This
type happens to be <EM>std::vector&lt;sub_match&lt;BidirectionalIterator&gt; &gt;</EM>,
but you shouldn't actually rely on that.</P>
<PRE><A name=m17></A>const capture_sequence_type&amp; <A href="#m8" >captures</A>(std::size_t i)const; </PRE>
<P><STRONG>Effects:</STRONG> returns a sequence containing all the captures
obtained for sub-expression <EM>i</EM>.</P>
<P><STRONG>Returns:</STRONG> <code>(*this)[i].captures();</code></P>
<P><STRONG>Preconditions:</STRONG> the library must be built and used with
BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag <A href="match_flag_type.html">
match_extra</A> to the regex matching functions (<A href="regex_match.html">regex_match</A>,
<A href="regex_search.html">regex_search</A>, <A href="regex_iterator.html">regex_iterator</A>
or <A href="regex_token_iterator.html">regex_token_iterator</A>) in order for
this member function to be defined and return useful information.</P>
<P><STRONG>Rationale:</STRONG> Enabling this feature has several consequences:
</P>
<UL>
<LI>
sub_match occupies more memory resulting in complex expressions running out of
memory or stack space more quickly during matching.
<LI>
The matching algorithms are less efficient at handling some features
(independent sub-expressions for example), even when match_extra is not used.
<LI>
The matching algorithms are much less efficient (i.e. slower), when match_extra
is used.&nbsp; Mostly this is down to the extra memory allocations that have to
take place.</LI></UL>
<h4>match_results non-members</h4>
<PRE><A name=n1></A>template &lt;class BidirectionalIterator, class Allocator&gt;
bool operator == (const match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
@ -418,10 +449,10 @@ void swap(match_results&lt;BidirectionalIterator, Allocator&gt;&amp; m1,
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -3,21 +3,20 @@
<head>
<title>Boost.Regex: sub_match</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head>
<body>
<P>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
<TR>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
<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">sub_match</H2>
</TD>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
<h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3>
</td>
</TR>
</TABLE>
@ -41,20 +40,28 @@
<P>Objects of type <EM>sub_match</EM> may be compared to objects of type <EM>std::basic_string</EM>,
or <EM>const charT*</EM> or <EM>const charT</EM>
.
<P>Objects of type <EM>sub_match</EM> may be added to objects of type <EM>std::basic_string</EM>,
or <EM>const charT* </EM>or <EM>const charT</EM>, to produce a new <EM>std::basic_string
</EM>
object.
<P>When the marked sub-expression denoted by an object of type sub_match&lt;&gt;
participated in a regular expression match then member <CODE>matched</CODE> evaluates
to true, and members <CODE>first</CODE> and <CODE>second</CODE> denote the
range of characters <CODE>[first,second)</CODE> which formed that match.
Otherwise <CODE>matched</CODE> is false, and members <CODE>first</CODE> and <CODE>second</CODE>
contained undefined values.</P>
<P>When the marked sub-expression denoted by an object of type sub_match&lt;&gt;
was repeated, then the sub_match object represents the match obtained by the
last repeat.&nbsp; The complete set of all the captures obtained for all the
repeats, may be accessed via the captures() member function (Note: this has
serious performance implications, you have to explicitly enable this feature).</P>
<P>If an object of type <CODE>sub_match&lt;&gt;</CODE> represents sub-expression 0
- that is to say the whole match - then member <CODE>matched</CODE> is always
true, unless a partial match was obtained as a result of the flag <CODE>match_partial</CODE>
being passed to a regular expression algorithm, in which case member <CODE>matched</CODE>
is false, and members <CODE>first</CODE> and <CODE>second</CODE> represent the
character range that formed the partial match.</P>
<PRE>
namespace boost{
<PRE>namespace boost{
template &lt;class BidirectionalIterator&gt;
class sub_match : public std::pair&lt;BidirectionalIterator, BidirectionalIterator&gt;
@ -64,36 +71,40 @@ public:
typedef typename iterator_traits&lt;BidirectionalIterator&gt;::difference_type difference_type;
typedef BidirectionalIterator iterator;
bool <A href="#m1">matched</A>;
bool <A href="#m1" >matched</A>;
difference_type <A href="#m2">length</A>()const;
operator <A href="#m3">basic_string</A>&lt;value_type&gt;()const;
basic_string&lt;value_type&gt; <A href="#m4">str</A>()const;
difference_type <A href="#m2" >length</A>()const;
operator <A href="#m3" >basic_string</A>&lt;value_type&gt;()const;
basic_string&lt;value_type&gt; <A href="#m4" >str</A>()const;
int <A href="#m5">compare</A>(const sub_match&amp; s)const;
int <A href="#m6">compare</A>(const basic_string&lt;value_type&gt;&amp; s)const;
int <A href="#m7">compare</A>(const value_type* s)const;
int <A href="#m5" >compare</A>(const sub_match&amp; s)const;
int <A href="#m6" >compare</A>(const basic_string&lt;value_type&gt;&amp; s)const;
int <A href="#m7" >compare</A>(const value_type* s)const;
#ifdef BOOST_REGEX_MATCH_EXTRA
typedef implementation-private <A href="#m9">capture_sequence_type</A>;
const capture_sequence_type&amp; <A href="#m8" >captures</A>()const;
#endif
};
//
// comparisons to another sub_match:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o11">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o11" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o12">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o12" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o13">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o13" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o14">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o14" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o15">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o15" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o16">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o16" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
@ -101,166 +112,165 @@ bool <A href="#o16">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&
// comparisons to a basic_string:
//
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o21">operator</A> == (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o21" >operator</A> == (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o22">operator</A> != (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o22" >operator</A> != (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o23">operator</A> &lt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o23" >operator</A> &lt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o24">operator</A> &gt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o24" >operator</A> &gt; (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o25">operator</A> &gt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o25" >operator</A> &gt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o26">operator</A> &lt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
bool <A href="#o26" >operator</A> &lt;= (const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o31">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o31" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o32">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o32" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o33">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o33" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o34">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o34" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o35">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o35" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
bool <A href="#o36">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o36" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const std::basic_string&lt;iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; rhs);
//
// comparisons to a pointer to a character array:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o41">operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o41" >operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o42">operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o42" >operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o43">operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o43" >operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o44">operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o44" >operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o45">operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o45" >operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o46">operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
bool <A href="#o46" >operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o51">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o51" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o52">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o52" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o53">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o53" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o54">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o54" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o55">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o55" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o56">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o56" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs);
//
// comparisons to a single character:
//
template &lt;class BidirectionalIterator&gt;
bool <A href="#o61">operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o61" >operator</A> == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o62">operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o62" >operator</A> != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o63">operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o63" >operator</A> &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o64">operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o64" >operator</A> &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o65">operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o65" >operator</A> &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o66">operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
bool <A href="#o66" >operator</A> &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o71">operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o71" >operator</A> == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o72">operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o72" >operator</A> != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o73">operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o73" >operator</A> &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o74">operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o74" >operator</A> &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o75">operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o75" >operator</A> &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
template &lt;class BidirectionalIterator&gt;
bool <A href="#o76">operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
bool <A href="#o76" >operator</A> &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs);
//
// addition operators:
//
template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o81">operator</A> + (const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o82">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s);
template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o83">operator</A> + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const* s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o84">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const * s);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o85">operator</A> + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o86">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s);
template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
<A href="#o87">operator</A> + (const sub_match&lt;RandomAccessIterator&gt;&amp; m1,
const sub_match&lt;RandomAccessIterator&gt;&amp; m2);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o81" >operator</A> + (const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
<A href="#o82" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s);
template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o83" >operator</A> + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o84" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const * s);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o85" >operator</A> + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o86" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s);
template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
<A href="#o87" >operator</A> + (const sub_match&lt;BidirectionalIterator&gt;&amp; m1,
const sub_match&lt;BidirectionalIterator&gt;&amp; m2);
//
// stream inserter:
//
template &lt;class charT, class traits, class BidirectionalIterator&gt;
basic_ostream&lt;charT, traits&gt;&amp;
<A href="#oi">operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
<A href="#oi" >operator</A> &lt;&lt; (basic_ostream&lt;charT, traits&gt;&amp; os,
const sub_match&lt;BidirectionalIterator&gt;&amp; m);
} // namespace boost</PRE>
<H3>Description</H3>
<H4>
sub_match members</H4>
<H4>sub_match members</H4>
<PRE>typedef typename std::iterator_traits&lt;iterator&gt;::value_type value_type;</PRE>
<P>The type pointed to by the iterators.</P>
<PRE>typedef typename std::iterator_traits&lt;iterator&gt;::difference_type difference_type;</PRE>
@ -274,59 +284,77 @@ basic_ostream&lt;charT, traits&gt;&amp;
<PRE><A name=m1></A>bool matched</PRE>
<P>A Boolean value denoting whether this sub-expression participated in the match.</P>
<PRE><A name=m2></A>static difference_type length();</PRE>
<P>
<B>Effects: </B>returns the length of this matched sub-expression, or 0 if this
<P><B>Effects: </B>returns the length of this matched sub-expression, or 0 if this
sub-expression was not matched: <CODE>matched ? distance(first, second) : 0)</CODE>.</P>
<PRE><A name=m3></A>operator basic_string&lt;value_type&gt;()const;</PRE>
<P>
<B>Effects: </B>converts *this into a string: returns <CODE>(matched ?
<P><B>Effects: </B>converts *this into a string: returns <CODE>(matched ?
basic_string&lt;value_type&gt;(first, second) :
basic_string&lt;value_type&gt;()).</P>
</CODE><PRE><A name=m4></A>basic_string&lt;value_type&gt; str()const;</PRE>
<P><B> Effects: </B>returns a string representation of *this:&nbsp; <CODE>(matched ?
<P><B>Effects: </B>returns a string representation of *this:&nbsp; <CODE>(matched ?
basic_string&lt;value_type&gt;(first, second) :
basic_string&lt;value_type&gt;())</CODE>.</P>
<PRE><A name=m5></A>int compare(const sub_match&amp; s)const;</PRE>
<P>
<B>Effects: </B>performs a lexical comparison to <EM>s</EM>: returns <CODE>str().compare(s.str())</CODE>.</P>
<P><B>Effects: </B>performs a lexical comparison to <EM>s</EM>: returns <CODE>str().compare(s.str())</CODE>.</P>
<PRE><A name=m6></A>int compare(const basic_string&lt;value_type&gt;&amp; s)const;</PRE>
<P><B> Effects: </B>compares *this to the string s: returns <CODE>str().compare(s)</CODE>.</P>
<P><B>Effects: </B>compares *this to the string s: returns <CODE>str().compare(s)</CODE>.</P>
<PRE><A name=m7></A>int compare(const value_type* s)const;</PRE>
<P>
<B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B>&nbsp;</B>returns
<P><B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B>&nbsp;</B>returns
<CODE>str().compare(s)</CODE>.</P>
<H4>
sub_match non-member operators</H4>
<PRE><A name=m9></A>typedef implementation-private capture_sequence_type;</PRE>
<P>Defines an implementation-specific type that&nbsp;satisfies the requirements of
a standard library Sequence (21.1.1 including the optional Table 68
operations),&nbsp;whose value_type is a <EM>sub_match&lt;BidirectionalIterator&gt;</EM>.&nbsp;This
type happens to be <EM>std::vector&lt;sub_match&lt;BidirectionalIterator&gt; &gt;</EM>,
but you shouldn't actually rely on that.</P>
<PRE><A name=m8></A>const capture_sequence_type&amp; <A href="#m8" >captures</A>()const; </PRE>
<P><STRONG>Effects:</STRONG> returns a sequence containing all the captures
obtained for this sub-expression.</P>
<P><STRONG>Preconditions:</STRONG> the library must be built and used with
BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag <A href="match_flag_type.html">
match_extra</A> to the regex matching functions (<A href="regex_match.html">regex_match</A>,
<A href="regex_search.html">regex_search</A>, <A href="regex_iterator.html">regex_iterator</A>
or <A href="regex_token_iterator.html">regex_token_iterator</A>) in order for
this member function to be defined and return useful information.</P>
<P><STRONG>Rationale:</STRONG> Enabling this feature has several consequences:
</P>
<UL>
<LI>
sub_match occupies more memory resulting in complex expressions running out of
memory or stack space more quickly during matching.
<LI>
The matching algorithms are less efficient at handling some features
(independent sub-expressions for example), even when match_extra is not used.
<LI>
The matching algorithms are much less efficient (i.e. slower), when match_extra
is used.&nbsp; Mostly this is down to the extra memory allocations that have to
take place.</LI></UL>
<H4>sub_match non-member operators</H4>
<H5>Comparisons against self</H5>
<PRE><A name=o11></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) == 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) == 0</CODE>.</P>
<PRE><A name=o12></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) != 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) != 0</CODE>.</P>
<PRE><A name=o13></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt; 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt; 0</CODE>.</P>
<PRE><A name=o14></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P><B> Effects: </B>returns <CODE>lhs.compare(rhs) &lt;= 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &lt;= 0</CODE>.</P>
<PRE><A name=o15></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt;= 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt;= 0</CODE>.</P>
<PRE><A name=o16></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs);</PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt; 0</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.compare(rhs) &gt; 0</CODE>.</P>
<H5>Comparisons with std::basic_string</H5>
<pre><A name=o21></A>
template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
@ -382,159 +410,135 @@ bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
<PRE><A name=o41></A>template &lt;class BidirectionalIterator&gt;
bool operator == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<PRE><A name=o42></A>template &lt;class BidirectionalIterator&gt;
bool operator != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<PRE></A><A name=o43></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<PRE><A name=o44></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<PRE><A name=o45></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<PRE><A name=o46></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<PRE><A name=o51></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<PRE><A name=o52></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<PRE><A name=o53></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<PRE><A name=o54></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<PRE><A name=o55></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<PRE><A name=o56></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<H5>Comparisons with a single character</H5>
<PRE><A name=o61></A>template &lt;class BidirectionalIterator&gt;
bool operator == (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs == rhs.str()</CODE>.</P>
<PRE><A name=o62></A>template &lt;class BidirectionalIterator&gt;
bool operator != (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs != rhs.str()</CODE>.</P>
<PRE><A name=o63></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt; rhs.str()</CODE>.</P>
<PRE><A name=o64></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt; rhs.str()</CODE>.</P>
<PRE><A name=o65></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &gt;= rhs.str()</CODE>.</P>
<PRE><A name=o66></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; lhs,
const sub_match&lt;BidirectionalIterator&gt;&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs &lt;= rhs.str()</CODE>.</P>
<PRE><A name=o71></A>template &lt;class BidirectionalIterator&gt;
bool operator == (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() == rhs</CODE>.</P>
<PRE><A name=o72></A>template &lt;class BidirectionalIterator&gt;
bool operator != (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() != rhs</CODE>.</P>
<PRE><A name=o73></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt; rhs</CODE>.</P>
<PRE><A name=o74></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt; (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt; rhs</CODE>.</P>
<PRE><A name=o75></A>template &lt;class BidirectionalIterator&gt;
bool operator &gt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &gt;= rhs</CODE>.</P>
<PRE><A name=o76></A>template &lt;class BidirectionalIterator&gt;
bool operator &lt;= (const sub_match&lt;BidirectionalIterator&gt;&amp; lhs,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; rhs); </PRE>
<P>
<B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<P><B>Effects: </B>returns <CODE>lhs.str() &lt;= rhs</CODE>.</P>
<h5>Addition operators</h5>
<P>The addition operators for sub_match allow you to add a sub_match to any type
to which you can add a std::string and obtain a new string as the result.</P>
<PRE><A name=o81></A>template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
operator + (const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o81></A>template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
operator + (const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o82></A>template &lt;class RandomAccessIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type, traits, Allocator&gt;&amp; s); </PRE>
<PRE><A name=o82></A>template &lt;class BidirectionalIterator, class traits, class Allocator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
const std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type, traits, Allocator&gt;&amp; s); </PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o83></A>template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const* s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o83></A>template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const* s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o84></A>template &lt;class RandomAccessIterator&gt; std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const * s);</PRE>
<PRE><A name=o84></A>template &lt;class BidirectionalIterator&gt; std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const * s);</PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o85></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s,
const sub_match&lt;RandomAccessIterator&gt;&amp; m); </PRE>
<PRE><A name=o85></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s,
const sub_match&lt;BidirectionalIterator&gt;&amp; m); </PRE>
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
<PRE><A name=o86></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m,
typename iterator_traits&lt;RandomAccessIterator&gt;::value_type const&amp; s); </PRE>
<PRE><A name=o86></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m,
typename iterator_traits&lt;BidirectionalIterator&gt;::value_type const&amp; s); </PRE>
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
<PRE><A name=o87></A>template &lt;class RandomAccessIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;RandomAccessIterator&gt;::value_type&gt;
operator + (const sub_match&lt;RandomAccessIterator&gt;&amp; m1,
const sub_match&lt;RandomAccessIterator&gt;&amp; m2);</PRE>
<PRE><A name=o87></A>template &lt;class BidirectionalIterator&gt;
std::basic_string&lt;typename iterator_traits&lt;BidirectionalIterator&gt;::value_type&gt;
operator + (const sub_match&lt;BidirectionalIterator&gt;&amp; m1,
const sub_match&lt;BidirectionalIterator&gt;&amp; m2);</PRE>
<P><B>Effects: </B>returns&nbsp;<CODE>m1.str() + m2.str()</CODE>.</P>
<h5>Stream inserter</h5>
<PRE><A name=oi></A>template &lt;class charT, class traits, class BidirectionalIterator&gt;
@ -549,10 +553,10 @@ basic_ostream&lt;charT, traits&gt;&amp;
24 Oct 2003
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>