mirror of
https://github.com/boostorg/regex.git
synced 2025-07-23 17:17:22 +02:00
Added new experimental captures support.
[SVN r21243]
This commit is contained in:
250
doc/Attic/captures.html
Normal file
250
doc/Attic/captures.html
Normal 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 $&, everything before the first match as $`,
|
||||
and everything after the match as $'. 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>$&</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>).
|
||||
So given:</P>
|
||||
<PRE>boost::match_results<IteratorType> 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>$&</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. 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. These functions return a container that contains a
|
||||
sequence of all the captures obtained during the regular expression
|
||||
matching. The following example program shows how this information may be
|
||||
used:</P>
|
||||
<PRE>#include <boost/regex.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void print_captures(const std::string& regx, const std::string& text)
|
||||
{
|
||||
boost::regex e(regx);
|
||||
boost::smatch what;
|
||||
std::cout << "Expression: \"" << regx << "\"\n";
|
||||
std::cout << "Text: \"" << text << "\"\n";
|
||||
if(boost::regex_match(text, what, e, boost::match_extra))
|
||||
{
|
||||
unsigned i, j;
|
||||
std::cout << "** Match found **\n Sub-Expressions:\n";
|
||||
for(i = 0; i < what.size(); ++i)
|
||||
std::cout << " $" << i << " = \"" << what[i] << "\"\n";
|
||||
std::cout << " Captures:\n";
|
||||
for(i = 0; i < what.size(); ++i)
|
||||
{
|
||||
std::cout << " $" << i << " = {";
|
||||
for(j = 0; j < what.captures(i).size(); ++j)
|
||||
{
|
||||
if(j)
|
||||
std::cout << ", ";
|
||||
else
|
||||
std::cout << " ";
|
||||
std::cout << "\"" << what.captures(i)[j] << "\"";
|
||||
}
|
||||
std::cout << " }\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "** 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+)|(?>\\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+)|(?>\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
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
12 Dec 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock
|
||||
<!--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>
|
||||
|
@ -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 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>
|
||||
|
@ -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 <<a href="../../../boost/regex.hpp">boost/regex.hpp</a>></p>
|
||||
<p>#include <<A href="../../../boost/regex.hpp">boost/regex.hpp</A>></p>
|
||||
<p>Regular expressions are different from many simple pattern-matching algorithms
|
||||
in that as well as finding an overall match they can also produce
|
||||
sub-expression matches: each sub-expression being delimited in the pattern by a
|
||||
pair of parenthesis (...). There has to be some method for reporting
|
||||
sub-expression matches back to the user: this is achieved this by defining a
|
||||
class <i>match_results</i> that acts as an indexed collection of sub-expression
|
||||
matches, each sub-expression match being contained in an object of type <i><a href="sub_match.html">
|
||||
sub_match</a></i> .</p>
|
||||
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> . 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> . 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 <class BidirectionalIterator,
|
||||
<pre>template <class BidirectionalIterator,
|
||||
class Allocator = allocator<sub_match<BidirectionalIterator> >
|
||||
class match_results;
|
||||
|
||||
@ -78,52 +76,58 @@ public:
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit <A href="#c1">match_results</A>(const Allocator& a = Allocator());
|
||||
<A href="#c2">match_results</A>(const match_results& m);
|
||||
<A href="#c3">match_results</A>& <A href="#c3">operator</A>=(const match_results& m);
|
||||
explicit <A href="#c1" >match_results</A>(const Allocator& a = Allocator());
|
||||
<A href="#c2" >match_results</A>(const match_results& m);
|
||||
<A href="#c3" >match_results</A>& <A href="#c3" >operator</A>=(const match_results& 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 <class OutputIterator>
|
||||
OutputIterator <A href="#m12">format</A>(OutputIterator out,
|
||||
OutputIterator <A href="#m12" >format</A>(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
match_flag_type flags = format_default) const;
|
||||
string_type <A href="#m13">format</A>(const string_type& fmt,
|
||||
string_type <A href="#m13" >format</A>(const string_type& 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& that);
|
||||
allocator_type <A href="#m14" >get_allocator</A>() const;
|
||||
void <A href="#m15" >swap</A>(match_results& that);
|
||||
|
||||
#ifdef BOOST_REGEX_MATCH_EXTRA
|
||||
typedef typename value_type::capture_sequence_type <A href="#m16" >capture_sequence_type</A>;
|
||||
const capture_sequence_type& <A href="#m17" >captures</A>(std::size_t i)const;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool <A href="#n1">operator</A> == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
bool <A href="#n1" >operator</A> == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool <A href="#n2">operator</A> != (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
bool <A href="#n2" >operator</A> != (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
|
||||
template <class charT, class traits, class BidirectionalIterator, class Allocator>
|
||||
basic_ostream<charT, traits>&
|
||||
<A href="#n3">operator</A> << (basic_ostream<charT, traits>& os,
|
||||
<A href="#n3" >operator</A> << (basic_ostream<charT, traits>& os,
|
||||
const match_results<BidirectionalIterator, Allocator>& m);
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
void <A href="#n4">swap</A>(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
void <A href="#n4" >swap</A>(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
match_results<BidirectionalIterator, Allocator>& m2);
|
||||
</pre>
|
||||
<h3><a name="description"></a>Description</h3>
|
||||
@ -139,42 +143,41 @@ match_results(const Allocator& 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<charT>()</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody></table>
|
||||
</center>
|
||||
<p> </p>
|
||||
<pre><A name=c2></A>
|
||||
@ -190,82 +193,81 @@ match_results& operator=(const match_results& 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 < 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 < 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 < 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 < 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 <class OutputIterator>
|
||||
<pre>template <class OutputIterator>
|
||||
OutputIterator format(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
|
||||
<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& 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& that);
|
||||
</pre>
|
||||
<H4><A name="m15"></A>Swap</H4>
|
||||
<PRE>void swap(match_results& 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& 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 satisfies the requirements of
|
||||
a standard library Sequence (21.1.1 including the optional Table 68
|
||||
operations), whose value_type is a <EM>sub_match<BidirectionalIterator></EM>. This
|
||||
type happens to be <EM>std::vector<sub_match<BidirectionalIterator> ></EM>,
|
||||
but you shouldn't actually rely on that.</P>
|
||||
<PRE><A name=m17></A>const capture_sequence_type& <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. 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 <class BidirectionalIterator, class Allocator>
|
||||
bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
@ -418,10 +449,10 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
24 Oct 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock 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>
|
||||
|
||||
|
@ -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<>
|
||||
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<>
|
||||
was repeated, then the sub_match object represents the match obtained by the
|
||||
last repeat. 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<></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 <class BidirectionalIterator>
|
||||
class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator>
|
||||
@ -64,36 +71,40 @@ public:
|
||||
typedef typename iterator_traits<BidirectionalIterator>::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><value_type>()const;
|
||||
basic_string<value_type> <A href="#m4">str</A>()const;
|
||||
difference_type <A href="#m2" >length</A>()const;
|
||||
operator <A href="#m3" >basic_string</A><value_type>()const;
|
||||
basic_string<value_type> <A href="#m4" >str</A>()const;
|
||||
|
||||
int <A href="#m5">compare</A>(const sub_match& s)const;
|
||||
int <A href="#m6">compare</A>(const basic_string<value_type>& s)const;
|
||||
int <A href="#m7">compare</A>(const value_type* s)const;
|
||||
int <A href="#m5" >compare</A>(const sub_match& s)const;
|
||||
int <A href="#m6" >compare</A>(const basic_string<value_type>& 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& <A href="#m8" >captures</A>()const;
|
||||
#endif
|
||||
};
|
||||
//
|
||||
// comparisons to another sub_match:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o11">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o11" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o12">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o12" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o13">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o13" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o14">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o14" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o15">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o15" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o16">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o16" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
|
||||
@ -101,166 +112,165 @@ bool <A href="#o16">operator</A> > (const sub_match<BidirectionalIterator&
|
||||
// comparisons to a basic_string:
|
||||
//
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o21">operator</A> == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o21" >operator</A> == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o22">operator</A> != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o22" >operator</A> != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o23">operator</A> < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o23" >operator</A> < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o24">operator</A> > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o24" >operator</A> > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o25">operator</A> >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o25" >operator</A> >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o26">operator</A> <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o26" >operator</A> <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o31">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o31" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o32">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o32" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o33">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o33" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o34">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o34" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o35">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o35" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o36">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o36" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
|
||||
//
|
||||
// comparisons to a pointer to a character array:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o41">operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o41" >operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o42">operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o42" >operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o43">operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o43" >operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o44">operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o44" >operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o45">operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o45" >operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o46">operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o46" >operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o51">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o51" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o52">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o52" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o53">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o53" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o54">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o54" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o55">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o55" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o56">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o56" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
|
||||
//
|
||||
// comparisons to a single character:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o61">operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o61" >operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o62">operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o62" >operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o63">operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o63" >operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o64">operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o64" >operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o65">operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o65" >operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o66">operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o66" >operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o71">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o71" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o72">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o72" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o73">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o73" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o74">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o74" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o75">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o75" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o76">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o76" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
//
|
||||
// addition operators:
|
||||
//
|
||||
template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
<A href="#o81">operator</A> + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
<A href="#o82">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s);
|
||||
template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o83">operator</A> + (typename iterator_traits<RandomAccessIterator>::value_type const* s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o84">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const * s);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o85">operator</A> + (typename iterator_traits<RandomAccessIterator>::value_type const& s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o86">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const& s);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o87">operator</A> + (const sub_match<RandomAccessIterator>& m1,
|
||||
const sub_match<RandomAccessIterator>& m2);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
<A href="#o81" >operator</A> + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
<A href="#o82" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s);
|
||||
template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o83" >operator</A> + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o84" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const * s);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o85" >operator</A> + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o86" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& s);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o87" >operator</A> + (const sub_match<BidirectionalIterator>& m1,
|
||||
const sub_match<BidirectionalIterator>& m2);
|
||||
|
||||
//
|
||||
// stream inserter:
|
||||
//
|
||||
template <class charT, class traits, class BidirectionalIterator>
|
||||
basic_ostream<charT, traits>&
|
||||
<A href="#oi">operator</A> << (basic_ostream<charT, traits>& os,
|
||||
<A href="#oi" >operator</A> << (basic_ostream<charT, traits>& os,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
|
||||
} // namespace boost</PRE>
|
||||
<H3>Description</H3>
|
||||
<H4>
|
||||
sub_match members</H4>
|
||||
<H4>sub_match members</H4>
|
||||
<PRE>typedef typename std::iterator_traits<iterator>::value_type value_type;</PRE>
|
||||
<P>The type pointed to by the iterators.</P>
|
||||
<PRE>typedef typename std::iterator_traits<iterator>::difference_type difference_type;</PRE>
|
||||
@ -274,59 +284,77 @@ basic_ostream<charT, traits>&
|
||||
<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<value_type>()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<value_type>(first, second) :
|
||||
basic_string<value_type>()).</P>
|
||||
</CODE><PRE><A name=m4></A>basic_string<value_type> str()const;</PRE>
|
||||
<P><B> Effects: </B>returns a string representation of *this: <CODE>(matched ?
|
||||
<P><B>Effects: </B>returns a string representation of *this: <CODE>(matched ?
|
||||
basic_string<value_type>(first, second) :
|
||||
basic_string<value_type>())</CODE>.</P>
|
||||
<PRE><A name=m5></A>int compare(const sub_match& 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<value_type>& 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> </B>returns
|
||||
<P><B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B> </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 satisfies the requirements of
|
||||
a standard library Sequence (21.1.1 including the optional Table 68
|
||||
operations), whose value_type is a <EM>sub_match<BidirectionalIterator></EM>. This
|
||||
type happens to be <EM>std::vector<sub_match<BidirectionalIterator> ></EM>,
|
||||
but you shouldn't actually rely on that.</P>
|
||||
<PRE><A name=m8></A>const capture_sequence_type& <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. 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 <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o14></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o15></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o16></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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>
|
||||
<H5>Comparisons with std::basic_string</H5>
|
||||
<pre><A name=o21></A>
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
@ -382,159 +410,135 @@ bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
<PRE><A name=o41></A>template <class BidirectionalIterator>
|
||||
bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o44></A>template <class BidirectionalIterator>
|
||||
bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o45></A>template <class BidirectionalIterator>
|
||||
bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o46></A>template <class BidirectionalIterator>
|
||||
bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o51></A>template <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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 <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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 <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o54></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o55></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o56></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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>
|
||||
<H5>Comparisons with a single character</H5>
|
||||
<PRE><A name=o61></A>template <class BidirectionalIterator>
|
||||
bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o64></A>template <class BidirectionalIterator>
|
||||
bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o65></A>template <class BidirectionalIterator>
|
||||
bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o66></A>template <class BidirectionalIterator>
|
||||
bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o71></A>template <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o72></A>template <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o73></A>template <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o74></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o75></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o76></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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>
|
||||
<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 <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o81></A>template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o82></A>template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); </PRE>
|
||||
<PRE><A name=o82></A>template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o83></A>template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o83></A>template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o84></A>template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const * s);</PRE>
|
||||
<PRE><A name=o84></A>template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const * s);</PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o85></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o85></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o86></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const& s); </PRE>
|
||||
<PRE><A name=o86></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& s); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o87></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m1,
|
||||
const sub_match<RandomAccessIterator>& m2);</PRE>
|
||||
<PRE><A name=o87></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m1,
|
||||
const sub_match<BidirectionalIterator>& m2);</PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m1.str() + m2.str()</CODE>.</P>
|
||||
<h5>Stream inserter</h5>
|
||||
<PRE><A name=oi></A>template <class charT, class traits, class BidirectionalIterator>
|
||||
@ -549,10 +553,10 @@ basic_ostream<charT, traits>&
|
||||
24 Oct 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock 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
250
doc/captures.html
Normal 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 $&, everything before the first match as $`,
|
||||
and everything after the match as $'. 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>$&</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>).
|
||||
So given:</P>
|
||||
<PRE>boost::match_results<IteratorType> 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>$&</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. 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. These functions return a container that contains a
|
||||
sequence of all the captures obtained during the regular expression
|
||||
matching. The following example program shows how this information may be
|
||||
used:</P>
|
||||
<PRE>#include <boost/regex.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void print_captures(const std::string& regx, const std::string& text)
|
||||
{
|
||||
boost::regex e(regx);
|
||||
boost::smatch what;
|
||||
std::cout << "Expression: \"" << regx << "\"\n";
|
||||
std::cout << "Text: \"" << text << "\"\n";
|
||||
if(boost::regex_match(text, what, e, boost::match_extra))
|
||||
{
|
||||
unsigned i, j;
|
||||
std::cout << "** Match found **\n Sub-Expressions:\n";
|
||||
for(i = 0; i < what.size(); ++i)
|
||||
std::cout << " $" << i << " = \"" << what[i] << "\"\n";
|
||||
std::cout << " Captures:\n";
|
||||
for(i = 0; i < what.size(); ++i)
|
||||
{
|
||||
std::cout << " $" << i << " = {";
|
||||
for(j = 0; j < what.captures(i).size(); ++j)
|
||||
{
|
||||
if(j)
|
||||
std::cout << ", ";
|
||||
else
|
||||
std::cout << " ";
|
||||
std::cout << "\"" << what.captures(i)[j] << "\"";
|
||||
}
|
||||
std::cout << " }\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "** 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+)|(?>\\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+)|(?>\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
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
12 Dec 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock
|
||||
<!--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>
|
||||
|
@ -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>
|
||||
|
@ -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 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>
|
||||
|
@ -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 <<a href="../../../boost/regex.hpp">boost/regex.hpp</a>></p>
|
||||
<p>#include <<A href="../../../boost/regex.hpp">boost/regex.hpp</A>></p>
|
||||
<p>Regular expressions are different from many simple pattern-matching algorithms
|
||||
in that as well as finding an overall match they can also produce
|
||||
sub-expression matches: each sub-expression being delimited in the pattern by a
|
||||
pair of parenthesis (...). There has to be some method for reporting
|
||||
sub-expression matches back to the user: this is achieved this by defining a
|
||||
class <i>match_results</i> that acts as an indexed collection of sub-expression
|
||||
matches, each sub-expression match being contained in an object of type <i><a href="sub_match.html">
|
||||
sub_match</a></i> .</p>
|
||||
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> . 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> . 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 <class BidirectionalIterator,
|
||||
<pre>template <class BidirectionalIterator,
|
||||
class Allocator = allocator<sub_match<BidirectionalIterator> >
|
||||
class match_results;
|
||||
|
||||
@ -78,52 +76,58 @@ public:
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit <A href="#c1">match_results</A>(const Allocator& a = Allocator());
|
||||
<A href="#c2">match_results</A>(const match_results& m);
|
||||
<A href="#c3">match_results</A>& <A href="#c3">operator</A>=(const match_results& m);
|
||||
explicit <A href="#c1" >match_results</A>(const Allocator& a = Allocator());
|
||||
<A href="#c2" >match_results</A>(const match_results& m);
|
||||
<A href="#c3" >match_results</A>& <A href="#c3" >operator</A>=(const match_results& 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 <class OutputIterator>
|
||||
OutputIterator <A href="#m12">format</A>(OutputIterator out,
|
||||
OutputIterator <A href="#m12" >format</A>(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
match_flag_type flags = format_default) const;
|
||||
string_type <A href="#m13">format</A>(const string_type& fmt,
|
||||
string_type <A href="#m13" >format</A>(const string_type& 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& that);
|
||||
allocator_type <A href="#m14" >get_allocator</A>() const;
|
||||
void <A href="#m15" >swap</A>(match_results& that);
|
||||
|
||||
#ifdef BOOST_REGEX_MATCH_EXTRA
|
||||
typedef typename value_type::capture_sequence_type <A href="#m16" >capture_sequence_type</A>;
|
||||
const capture_sequence_type& <A href="#m17" >captures</A>(std::size_t i)const;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool <A href="#n1">operator</A> == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
bool <A href="#n1" >operator</A> == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
bool <A href="#n2">operator</A> != (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
bool <A href="#n2" >operator</A> != (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
const match_results<BidirectionalIterator, Allocator>& m2);
|
||||
|
||||
template <class charT, class traits, class BidirectionalIterator, class Allocator>
|
||||
basic_ostream<charT, traits>&
|
||||
<A href="#n3">operator</A> << (basic_ostream<charT, traits>& os,
|
||||
<A href="#n3" >operator</A> << (basic_ostream<charT, traits>& os,
|
||||
const match_results<BidirectionalIterator, Allocator>& m);
|
||||
|
||||
template <class BidirectionalIterator, class Allocator>
|
||||
void <A href="#n4">swap</A>(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
void <A href="#n4" >swap</A>(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
match_results<BidirectionalIterator, Allocator>& m2);
|
||||
</pre>
|
||||
<h3><a name="description"></a>Description</h3>
|
||||
@ -139,42 +143,41 @@ match_results(const Allocator& 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<charT>()</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody></table>
|
||||
</center>
|
||||
<p> </p>
|
||||
<pre><A name=c2></A>
|
||||
@ -190,82 +193,81 @@ match_results& operator=(const match_results& 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 < 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 < 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 < 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 < 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 <class OutputIterator>
|
||||
<pre>template <class OutputIterator>
|
||||
OutputIterator format(OutputIterator out,
|
||||
const string_type& fmt,
|
||||
<a href="match_flag_type.html">match_flag_type</a> flags = format_default);
|
||||
<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& 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& that);
|
||||
</pre>
|
||||
<H4><A name="m15"></A>Swap</H4>
|
||||
<PRE>void swap(match_results& 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& 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 satisfies the requirements of
|
||||
a standard library Sequence (21.1.1 including the optional Table 68
|
||||
operations), whose value_type is a <EM>sub_match<BidirectionalIterator></EM>. This
|
||||
type happens to be <EM>std::vector<sub_match<BidirectionalIterator> ></EM>,
|
||||
but you shouldn't actually rely on that.</P>
|
||||
<PRE><A name=m17></A>const capture_sequence_type& <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. 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 <class BidirectionalIterator, class Allocator>
|
||||
bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
|
||||
@ -418,10 +449,10 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,
|
||||
24 Oct 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock 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>
|
||||
|
||||
|
@ -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<>
|
||||
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<>
|
||||
was repeated, then the sub_match object represents the match obtained by the
|
||||
last repeat. 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<></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 <class BidirectionalIterator>
|
||||
class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator>
|
||||
@ -64,36 +71,40 @@ public:
|
||||
typedef typename iterator_traits<BidirectionalIterator>::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><value_type>()const;
|
||||
basic_string<value_type> <A href="#m4">str</A>()const;
|
||||
difference_type <A href="#m2" >length</A>()const;
|
||||
operator <A href="#m3" >basic_string</A><value_type>()const;
|
||||
basic_string<value_type> <A href="#m4" >str</A>()const;
|
||||
|
||||
int <A href="#m5">compare</A>(const sub_match& s)const;
|
||||
int <A href="#m6">compare</A>(const basic_string<value_type>& s)const;
|
||||
int <A href="#m7">compare</A>(const value_type* s)const;
|
||||
int <A href="#m5" >compare</A>(const sub_match& s)const;
|
||||
int <A href="#m6" >compare</A>(const basic_string<value_type>& 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& <A href="#m8" >captures</A>()const;
|
||||
#endif
|
||||
};
|
||||
//
|
||||
// comparisons to another sub_match:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o11">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o11" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o12">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o12" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o13">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o13" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o14">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o14" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o15">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o15" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o16">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o16" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
|
||||
@ -101,166 +112,165 @@ bool <A href="#o16">operator</A> > (const sub_match<BidirectionalIterator&
|
||||
// comparisons to a basic_string:
|
||||
//
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o21">operator</A> == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o21" >operator</A> == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o22">operator</A> != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o22" >operator</A> != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o23">operator</A> < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o23" >operator</A> < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o24">operator</A> > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o24" >operator</A> > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o25">operator</A> >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o25" >operator</A> >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o26">operator</A> <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
bool <A href="#o26" >operator</A> <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o31">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o31" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o32">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o32" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o33">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o33" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o34">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o34" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o35">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o35" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
bool <A href="#o36">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o36" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
|
||||
|
||||
//
|
||||
// comparisons to a pointer to a character array:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o41">operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o41" >operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o42">operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o42" >operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o43">operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o43" >operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o44">operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o44" >operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o45">operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o45" >operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o46">operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
bool <A href="#o46" >operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o51">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o51" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o52">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o52" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o53">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o53" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o54">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o54" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o55">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o55" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o56">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o56" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
|
||||
|
||||
//
|
||||
// comparisons to a single character:
|
||||
//
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o61">operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o61" >operator</A> == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o62">operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o62" >operator</A> != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o63">operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o63" >operator</A> < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o64">operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o64" >operator</A> > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o65">operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o65" >operator</A> >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o66">operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
bool <A href="#o66" >operator</A> <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& rhs);
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o71">operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o71" >operator</A> == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o72">operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o72" >operator</A> != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o73">operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o73" >operator</A> < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o74">operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o74" >operator</A> > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o75">operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o75" >operator</A> >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
template <class BidirectionalIterator>
|
||||
bool <A href="#o76">operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
bool <A href="#o76" >operator</A> <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
|
||||
//
|
||||
// addition operators:
|
||||
//
|
||||
template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
<A href="#o81">operator</A> + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
<A href="#o82">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s);
|
||||
template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o83">operator</A> + (typename iterator_traits<RandomAccessIterator>::value_type const* s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o84">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const * s);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o85">operator</A> + (typename iterator_traits<RandomAccessIterator>::value_type const& s,
|
||||
const sub_match<RandomAccessIterator>& m);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o86">operator</A> + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const& s);
|
||||
template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
<A href="#o87">operator</A> + (const sub_match<RandomAccessIterator>& m1,
|
||||
const sub_match<RandomAccessIterator>& m2);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
<A href="#o81" >operator</A> + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
<A href="#o82" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s);
|
||||
template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o83" >operator</A> + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o84" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const * s);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o85" >operator</A> + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o86" >operator</A> + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& s);
|
||||
template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
<A href="#o87" >operator</A> + (const sub_match<BidirectionalIterator>& m1,
|
||||
const sub_match<BidirectionalIterator>& m2);
|
||||
|
||||
//
|
||||
// stream inserter:
|
||||
//
|
||||
template <class charT, class traits, class BidirectionalIterator>
|
||||
basic_ostream<charT, traits>&
|
||||
<A href="#oi">operator</A> << (basic_ostream<charT, traits>& os,
|
||||
<A href="#oi" >operator</A> << (basic_ostream<charT, traits>& os,
|
||||
const sub_match<BidirectionalIterator>& m);
|
||||
|
||||
} // namespace boost</PRE>
|
||||
<H3>Description</H3>
|
||||
<H4>
|
||||
sub_match members</H4>
|
||||
<H4>sub_match members</H4>
|
||||
<PRE>typedef typename std::iterator_traits<iterator>::value_type value_type;</PRE>
|
||||
<P>The type pointed to by the iterators.</P>
|
||||
<PRE>typedef typename std::iterator_traits<iterator>::difference_type difference_type;</PRE>
|
||||
@ -274,59 +284,77 @@ basic_ostream<charT, traits>&
|
||||
<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<value_type>()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<value_type>(first, second) :
|
||||
basic_string<value_type>()).</P>
|
||||
</CODE><PRE><A name=m4></A>basic_string<value_type> str()const;</PRE>
|
||||
<P><B> Effects: </B>returns a string representation of *this: <CODE>(matched ?
|
||||
<P><B>Effects: </B>returns a string representation of *this: <CODE>(matched ?
|
||||
basic_string<value_type>(first, second) :
|
||||
basic_string<value_type>())</CODE>.</P>
|
||||
<PRE><A name=m5></A>int compare(const sub_match& 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<value_type>& 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> </B>returns
|
||||
<P><B>Effects:<B></B> </B>compares *this to the null-terminated string <EM>s</EM>:<B> </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 satisfies the requirements of
|
||||
a standard library Sequence (21.1.1 including the optional Table 68
|
||||
operations), whose value_type is a <EM>sub_match<BidirectionalIterator></EM>. This
|
||||
type happens to be <EM>std::vector<sub_match<BidirectionalIterator> ></EM>,
|
||||
but you shouldn't actually rely on that.</P>
|
||||
<PRE><A name=m8></A>const capture_sequence_type& <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. 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 <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o14></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o15></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o16></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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>
|
||||
<H5>Comparisons with std::basic_string</H5>
|
||||
<pre><A name=o21></A>
|
||||
template <class BidirectionalIterator, class traits, class Allocator>
|
||||
@ -382,159 +410,135 @@ bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
<PRE><A name=o41></A>template <class BidirectionalIterator>
|
||||
bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o44></A>template <class BidirectionalIterator>
|
||||
bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o45></A>template <class BidirectionalIterator>
|
||||
bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o46></A>template <class BidirectionalIterator>
|
||||
bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o51></A>template <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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 <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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 <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o54></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o55></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o56></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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>
|
||||
<H5>Comparisons with a single character</H5>
|
||||
<PRE><A name=o61></A>template <class BidirectionalIterator>
|
||||
bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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 <class BidirectionalIterator>
|
||||
bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o64></A>template <class BidirectionalIterator>
|
||||
bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o65></A>template <class BidirectionalIterator>
|
||||
bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o66></A>template <class BidirectionalIterator>
|
||||
bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
|
||||
const sub_match<BidirectionalIterator>& 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=o71></A>template <class BidirectionalIterator>
|
||||
bool operator == (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o72></A>template <class BidirectionalIterator>
|
||||
bool operator != (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o73></A>template <class BidirectionalIterator>
|
||||
bool operator < (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o74></A>template <class BidirectionalIterator>
|
||||
bool operator > (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o75></A>template <class BidirectionalIterator>
|
||||
bool operator >= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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=o76></A>template <class BidirectionalIterator>
|
||||
bool operator <= (const sub_match<BidirectionalIterator>& lhs,
|
||||
typename iterator_traits<BidirectionalIterator>::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>
|
||||
<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 <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o81></A>template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o82></A>template <class RandomAccessIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); </PRE>
|
||||
<PRE><A name=o82></A>template <class BidirectionalIterator, class traits, class Allocator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& s); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o83></A>template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o83></A>template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o84></A>template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const * s);</PRE>
|
||||
<PRE><A name=o84></A>template <class BidirectionalIterator> std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const * s);</PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o85></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s,
|
||||
const sub_match<RandomAccessIterator>& m); </PRE>
|
||||
<PRE><A name=o85></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
|
||||
const sub_match<BidirectionalIterator>& m); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>s + m.str()</CODE>.</P>
|
||||
<PRE><A name=o86></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m,
|
||||
typename iterator_traits<RandomAccessIterator>::value_type const& s); </PRE>
|
||||
<PRE><A name=o86></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m,
|
||||
typename iterator_traits<BidirectionalIterator>::value_type const& s); </PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m.str() + s</CODE>.</P>
|
||||
<PRE><A name=o87></A>template <class RandomAccessIterator>
|
||||
std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type>
|
||||
operator + (const sub_match<RandomAccessIterator>& m1,
|
||||
const sub_match<RandomAccessIterator>& m2);</PRE>
|
||||
<PRE><A name=o87></A>template <class BidirectionalIterator>
|
||||
std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
|
||||
operator + (const sub_match<BidirectionalIterator>& m1,
|
||||
const sub_match<BidirectionalIterator>& m2);</PRE>
|
||||
<P><B>Effects: </B>returns <CODE>m1.str() + m2.str()</CODE>.</P>
|
||||
<h5>Stream inserter</h5>
|
||||
<PRE><A name=oi></A>template <class charT, class traits, class BidirectionalIterator>
|
||||
@ -549,10 +553,10 @@ basic_ostream<charT, traits>&
|
||||
24 Oct 2003
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||
<p><i><EFBFBD> Copyright John Maddock 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>
|
||||
|
||||
|
Reference in New Issue
Block a user