mirror of
https://github.com/boostorg/regex.git
synced 2025-12-17 02:48:48 +01:00
Compare commits
32 Commits
boost-1.90
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6732abe03e | ||
|
|
eec095b121 | ||
|
|
bd8de55174 | ||
|
|
3fd3f23e6e | ||
|
|
cf6f69258c | ||
|
|
d1649417d1 | ||
|
|
5fed1798dd | ||
|
|
b0e83b535a | ||
|
|
91e7e3b602 | ||
|
|
8d76f35c64 | ||
|
|
92bf09979a | ||
|
|
ca9a970d6f | ||
|
|
2816f0e1ca | ||
|
|
afd2bf331a | ||
|
|
fb844f004e | ||
|
|
283548f948 | ||
|
|
77595dddba | ||
|
|
edc9f4d288 | ||
|
|
f60ed016e7 | ||
|
|
5503fa8fb7 | ||
|
|
5cce92fa23 | ||
|
|
b35a6eabbd | ||
|
|
62e79baf65 | ||
|
|
f7abd42972 | ||
|
|
82abe57838 | ||
|
|
5babdbfa82 | ||
|
|
f8cd505f18 | ||
|
|
3b3becb57c | ||
|
|
d717e0a962 | ||
|
|
8a2e6a5dfb | ||
|
|
b984803077 | ||
|
|
a952ab8c15 |
@@ -18,6 +18,7 @@
|
|||||||
# compiler:
|
# compiler:
|
||||||
CXX=g++
|
CXX=g++
|
||||||
LINKER=g++ -shared
|
LINKER=g++ -shared
|
||||||
|
AR=ar
|
||||||
|
|
||||||
#
|
#
|
||||||
# compiler options for release build:
|
# compiler options for release build:
|
||||||
@@ -94,8 +95,8 @@ boost_regex-gcc-1_31_clean :
|
|||||||
rm -f gcc/boost_regex-gcc-1_31/*.o
|
rm -f gcc/boost_regex-gcc-1_31/*.o
|
||||||
|
|
||||||
./gcc/libboost_regex-gcc-1_31.a : gcc/boost_regex-gcc-1_31/c_regex_traits.o gcc/boost_regex-gcc-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-1_31/cregex.o gcc/boost_regex-gcc-1_31/fileiter.o gcc/boost_regex-gcc-1_31/instances.o gcc/boost_regex-gcc-1_31/posix_api.o gcc/boost_regex-gcc-1_31/regex.o gcc/boost_regex-gcc-1_31/regex_debug.o gcc/boost_regex-gcc-1_31/regex_synch.o gcc/boost_regex-gcc-1_31/w32_regex_traits.o gcc/boost_regex-gcc-1_31/wide_posix_api.o gcc/boost_regex-gcc-1_31/winstances.o
|
./gcc/libboost_regex-gcc-1_31.a : gcc/boost_regex-gcc-1_31/c_regex_traits.o gcc/boost_regex-gcc-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-1_31/cregex.o gcc/boost_regex-gcc-1_31/fileiter.o gcc/boost_regex-gcc-1_31/instances.o gcc/boost_regex-gcc-1_31/posix_api.o gcc/boost_regex-gcc-1_31/regex.o gcc/boost_regex-gcc-1_31/regex_debug.o gcc/boost_regex-gcc-1_31/regex_synch.o gcc/boost_regex-gcc-1_31/w32_regex_traits.o gcc/boost_regex-gcc-1_31/wide_posix_api.o gcc/boost_regex-gcc-1_31/winstances.o
|
||||||
ar -r gcc/libboost_regex-gcc-1_31.a gcc/boost_regex-gcc-1_31/c_regex_traits.o gcc/boost_regex-gcc-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-1_31/cregex.o gcc/boost_regex-gcc-1_31/fileiter.o gcc/boost_regex-gcc-1_31/instances.o gcc/boost_regex-gcc-1_31/posix_api.o gcc/boost_regex-gcc-1_31/regex.o gcc/boost_regex-gcc-1_31/regex_debug.o gcc/boost_regex-gcc-1_31/regex_synch.o gcc/boost_regex-gcc-1_31/w32_regex_traits.o gcc/boost_regex-gcc-1_31/wide_posix_api.o gcc/boost_regex-gcc-1_31/winstances.o
|
$(AR) -r gcc/libboost_regex-gcc-1_31.a gcc/boost_regex-gcc-1_31/c_regex_traits.o gcc/boost_regex-gcc-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-1_31/cregex.o gcc/boost_regex-gcc-1_31/fileiter.o gcc/boost_regex-gcc-1_31/instances.o gcc/boost_regex-gcc-1_31/posix_api.o gcc/boost_regex-gcc-1_31/regex.o gcc/boost_regex-gcc-1_31/regex_debug.o gcc/boost_regex-gcc-1_31/regex_synch.o gcc/boost_regex-gcc-1_31/w32_regex_traits.o gcc/boost_regex-gcc-1_31/wide_posix_api.o gcc/boost_regex-gcc-1_31/winstances.o
|
||||||
-ar -s gcc/libboost_regex-gcc-1_31.a
|
-$(AR) -s gcc/libboost_regex-gcc-1_31.a
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
#
|
#
|
||||||
@@ -148,6 +149,6 @@ boost_regex-gcc-d-1_31_clean :
|
|||||||
rm -f gcc/boost_regex-gcc-d-1_31/*.o
|
rm -f gcc/boost_regex-gcc-d-1_31/*.o
|
||||||
|
|
||||||
./gcc/libboost_regex-gcc-d-1_31.a : gcc/boost_regex-gcc-d-1_31/c_regex_traits.o gcc/boost_regex-gcc-d-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-d-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-d-1_31/cregex.o gcc/boost_regex-gcc-d-1_31/fileiter.o gcc/boost_regex-gcc-d-1_31/instances.o gcc/boost_regex-gcc-d-1_31/posix_api.o gcc/boost_regex-gcc-d-1_31/regex.o gcc/boost_regex-gcc-d-1_31/regex_debug.o gcc/boost_regex-gcc-d-1_31/regex_synch.o gcc/boost_regex-gcc-d-1_31/w32_regex_traits.o gcc/boost_regex-gcc-d-1_31/wide_posix_api.o gcc/boost_regex-gcc-d-1_31/winstances.o
|
./gcc/libboost_regex-gcc-d-1_31.a : gcc/boost_regex-gcc-d-1_31/c_regex_traits.o gcc/boost_regex-gcc-d-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-d-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-d-1_31/cregex.o gcc/boost_regex-gcc-d-1_31/fileiter.o gcc/boost_regex-gcc-d-1_31/instances.o gcc/boost_regex-gcc-d-1_31/posix_api.o gcc/boost_regex-gcc-d-1_31/regex.o gcc/boost_regex-gcc-d-1_31/regex_debug.o gcc/boost_regex-gcc-d-1_31/regex_synch.o gcc/boost_regex-gcc-d-1_31/w32_regex_traits.o gcc/boost_regex-gcc-d-1_31/wide_posix_api.o gcc/boost_regex-gcc-d-1_31/winstances.o
|
||||||
ar -r gcc/libboost_regex-gcc-d-1_31.a gcc/boost_regex-gcc-d-1_31/c_regex_traits.o gcc/boost_regex-gcc-d-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-d-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-d-1_31/cregex.o gcc/boost_regex-gcc-d-1_31/fileiter.o gcc/boost_regex-gcc-d-1_31/instances.o gcc/boost_regex-gcc-d-1_31/posix_api.o gcc/boost_regex-gcc-d-1_31/regex.o gcc/boost_regex-gcc-d-1_31/regex_debug.o gcc/boost_regex-gcc-d-1_31/regex_synch.o gcc/boost_regex-gcc-d-1_31/w32_regex_traits.o gcc/boost_regex-gcc-d-1_31/wide_posix_api.o gcc/boost_regex-gcc-d-1_31/winstances.o
|
$(AR) -r gcc/libboost_regex-gcc-d-1_31.a gcc/boost_regex-gcc-d-1_31/c_regex_traits.o gcc/boost_regex-gcc-d-1_31/c_regex_traits_common.o gcc/boost_regex-gcc-d-1_31/cpp_regex_traits.o gcc/boost_regex-gcc-d-1_31/cregex.o gcc/boost_regex-gcc-d-1_31/fileiter.o gcc/boost_regex-gcc-d-1_31/instances.o gcc/boost_regex-gcc-d-1_31/posix_api.o gcc/boost_regex-gcc-d-1_31/regex.o gcc/boost_regex-gcc-d-1_31/regex_debug.o gcc/boost_regex-gcc-d-1_31/regex_synch.o gcc/boost_regex-gcc-d-1_31/w32_regex_traits.o gcc/boost_regex-gcc-d-1_31/wide_posix_api.o gcc/boost_regex-gcc-d-1_31/winstances.o
|
||||||
-ar -s gcc/libboost_regex-gcc-d-1_31.a
|
-$(AR) -s gcc/libboost_regex-gcc-d-1_31.a
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p></p>
|
<p></p>
|
||||||
|
<P>Captures are the iterator ranges that are "captured" by marked sub-expressions
|
||||||
|
as a regular expression gets matched. Each marked sub-expression can
|
||||||
|
result in more than one capture, if it is matched more than once. This
|
||||||
|
document explains how captures and marked sub-expressions in Boost.Regex are
|
||||||
|
represented and accessed.</P>
|
||||||
<H2>Marked sub-expressions</H2>
|
<H2>Marked sub-expressions</H2>
|
||||||
<P>Every time a Perl regular expression contains a parenthesis group (), it spits
|
<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
|
out an extra field, known as a marked sub-expression, for example the
|
||||||
@@ -247,4 +252,3 @@ Text: "now is the time for all good men to come to the aid of the party"
|
|||||||
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -25,25 +25,32 @@
|
|||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<HR>
|
<HR>
|
||||||
<P>The author can be contacted at john@johnmaddock.co.uk; the
|
<P>The author can be contacted at john@johnmaddock.co.uk; the home page for
|
||||||
home page for this library is at <A href="http://www.boost.org">www.boost.org</A>.</P>
|
this library is at <A href="http://www.boost.org">www.boost.org</A>.</P>
|
||||||
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think
|
<P>I am indebted to <A href="http://www.cs.princeton.edu/~rs/">Robert Sedgewick's
|
||||||
about algorithms and their performance, and to the folks at boost for forcing
|
"Algorithms in C++" </A>for forcing me to think about algorithms and their
|
||||||
me to <I>think</I>, period. The following people have all contributed useful
|
performance, and to the folks at <A href="http://www.boost.org">boost</A> for
|
||||||
comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
|
forcing me to <I>think</I>, period.</P>
|
||||||
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
<P><A href="http://www.boost-consulting.com">Eric Niebler</A>, author of the <A href="http://research.microsoft.com/projects/greta">
|
||||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias
|
GRETA regular expression component</A>, has shared several important ideas,
|
||||||
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones,
|
in a series of long discussions.</P>
|
||||||
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens
|
<P>Pete Becker, of <A href="http://www.dinkumware.com/">Dinkumware Ltd</A>, has
|
||||||
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
|
helped enormously with the standardisation proposal language.</P>
|
||||||
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc
|
<P>The following people have all contributed useful comments or fixes: Dave
|
||||||
Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, Jan B<>lsche,
|
||||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals
|
Beman Dawes, Paul Baxter, David Bergman, David Dennerline, Edward Diener, Peter
|
||||||
supplied with the Henry Spencer, Perl and GNU regular expression libraries -
|
Dimov, Robert Dunn, Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc Gregoire,
|
||||||
wherever possible I have tried to maintain compatibility with these libraries
|
Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
|
||||||
and with the POSIX standard - the code however is entirely my own, including
|
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
|
||||||
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know
|
Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander Sokolovsky,
|
||||||
about, so if you have any comments or spot any bugs, please get in touch.</P>
|
Herv<EFBFBD> Poirier, Michael Raykh, Marc Recht, Scott VanCamp, Bruno Voigt, Alexey
|
||||||
|
Voinov, Jerry Waldorf, Rob Ward, Lealon Watts, John Wismar, Thomas Witt and
|
||||||
|
Yuval Yosef. I am also grateful to the manuals supplied with the Henry Spencer,
|
||||||
|
Perl and GNU regular expression libraries - wherever possible I have tried to
|
||||||
|
maintain compatibility with these libraries and with the POSIX standard - the
|
||||||
|
code however is entirely my own, including any bugs! I can absolutely guarantee
|
||||||
|
that I will not fix any bugs I don't know about, so if you have any comments or
|
||||||
|
spot any bugs, please get in touch.</P>
|
||||||
<P>Useful further information can be found at:</P>
|
<P>Useful further information can be found at:</P>
|
||||||
<P>Short tutorials on regular expressions can be <A href="http://etext.lib.virginia.edu/helpsheets/regex.html">
|
<P>Short tutorials on regular expressions can be <A href="http://etext.lib.virginia.edu/helpsheets/regex.html">
|
||||||
found here</A> and <A href="http://www.devshed.com/Server_Side/Administration/RegExp/page1.html">here</A>.</P>
|
found here</A> and <A href="http://www.devshed.com/Server_Side/Administration/RegExp/page1.html">here</A>.</P>
|
||||||
@@ -72,8 +79,7 @@
|
|||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -1,153 +1,114 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
<title>Boost.Regex: FAQ</title>
|
||||||
<title>Boost.Regex: FAQ</title>
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||||
<meta http-equiv="Content-Type" content=
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
"text/html; charset=iso-8859-1">
|
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body>
|
<p></p>
|
||||||
<p></p>
|
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||||
|
<tr>
|
||||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
<td valign="top" width="300">
|
||||||
border="0">
|
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||||
<tr>
|
</td>
|
||||||
<td valign="top" width="300">
|
<td width="353">
|
||||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
<h1 align="center">Boost.Regex</h1>
|
||||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
<h2 align="center">FAQ</h2>
|
||||||
</td>
|
</td>
|
||||||
<td width="353">
|
<td width="50">
|
||||||
<h1 align="center">Boost.Regex</h1>
|
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||||
|
</td>
|
||||||
<h2 align="center">FAQ</h2>
|
</tr>
|
||||||
</td>
|
</table>
|
||||||
<td width="50">
|
<br>
|
||||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
<br>
|
||||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
<hr>
|
||||||
</td>
|
<font color="#ff0000"><font color="#ff0000"></font></font>
|
||||||
</tr>
|
<p><font color="#ff0000"><font color="#ff0000"><font color="#ff0000"> Q. Why can't I
|
||||||
</table>
|
use the "convenience" versions of regex_match / regex_search / regex_grep /
|
||||||
|
regex_format / regex_merge?</font></font></font></p>
|
||||||
<br>
|
<p>A. These versions may or may not be available depending upon the capabilities
|
||||||
<br>
|
of your compiler, the rules determining the format of these functions are quite
|
||||||
|
complex - and only the versions visible to a standard compliant compiler are
|
||||||
|
given in the help. To find out what your compiler supports, run
|
||||||
<hr>
|
<boost/regex.hpp> through your C++ pre-processor, and search the output
|
||||||
<font color="#ff0000"><font color="#ff0000"></font></font>
|
file for the function that you are interested in.<font color="#ff0000"><font color="#ff0000"></font></font></p>
|
||||||
<p><font color="#ff0000"><font color="#ff0000"><font color=
|
<p><font color="#ff0000"><font color="#ff0000">Q. I can't get regex++ to work with
|
||||||
"#ff0000"> Q. Why can't I use the "convenience" versions of
|
escape characters, what's going on?</font></font></p>
|
||||||
regex_match / regex_search / regex_grep / regex_format /
|
<p>A. If you embed regular expressions in C++ code, then remember that escape
|
||||||
regex_merge?</font></font></font></p>
|
characters are processed twice: once by the C++ compiler, and once by the
|
||||||
|
regex++ expression compiler, so to pass the regular expression \d+ to regex++,
|
||||||
<p>A. These versions may or may not be available depending upon the
|
you need to embed "\\d+" in your code. Likewise to match a literal backslash
|
||||||
capabilities of your compiler, the rules determining the format of
|
you will need to embed "\\\\" in your code. <font color="#ff0000"></font>
|
||||||
these functions are quite complex - and only the versions visible
|
</p>
|
||||||
to a standard compliant compiler are given in the help. To find out
|
<p><font color="#ff0000">Q. Why does using parenthesis in a POSIX regular expression
|
||||||
what your compiler supports, run <boost/regex.hpp> through
|
change the result of a match?</font></p>
|
||||||
your C++ pre-processor, and search the output file for the function
|
<p>For POSIX (extended and basic) regular expressions, but not for perl regexes,
|
||||||
that you are interested in.<font color="#ff0000"><font color=
|
parentheses don't only mark; they determine what the best match is as well.
|
||||||
"#ff0000"></font></font></p>
|
When the expression is compiled as a POSIX basic or extended regex then
|
||||||
|
Boost.regex follows the POSIX standard leftmost longest rule for determining
|
||||||
<p><font color="#ff0000"><font color="#ff0000">Q. I can't get
|
what matched. So if there is more than one possible match after considering the
|
||||||
regex++ to work with escape characters, what's going
|
whole expression, it looks next at the first sub-expression and then the second
|
||||||
on?</font></font></p>
|
sub-expression and so on. So...</p>
|
||||||
|
<pre>
|
||||||
<p>A. If you embed regular expressions in C++ code, then remember
|
|
||||||
that escape characters are processed twice: once by the C++
|
|
||||||
compiler, and once by the regex++ expression compiler, so to pass
|
|
||||||
the regular expression \d+ to regex++, you need to embed "\\d+" in
|
|
||||||
your code. Likewise to match a literal backslash you will need to
|
|
||||||
embed "\\\\" in your code. <font color="#ff0000"></font></p>
|
|
||||||
|
|
||||||
<p><font color="#ff0000">Q. Why does using parenthesis in a POSIX
|
|
||||||
regular expression change the result of a match?</font></p>
|
|
||||||
|
|
||||||
<p>For POSIX (extended and basic) regular expressions, but not for
|
|
||||||
perl regexes, parentheses don't only mark; they determine what the
|
|
||||||
best match is as well. When the expression is compiled as a POSIX
|
|
||||||
basic or extended regex then Boost.regex follows the POSIX standard
|
|
||||||
leftmost longest rule for determining what matched. So if there is
|
|
||||||
more than one possible match after considering the whole
|
|
||||||
expression, it looks next at the first sub-expression and then the
|
|
||||||
second sub-expression and so on. So...</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
"(0*)([0-9]*)" against "00123" would produce
|
"(0*)([0-9]*)" against "00123" would produce
|
||||||
$1 = "00"
|
$1 = "00"
|
||||||
$2 = "123"
|
$2 = "123"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>where as</p>
|
||||||
<p>where as</p>
|
<pre>
|
||||||
|
"0*([0-9])*" against "00123" would produce
|
||||||
<pre>
|
|
||||||
"0*([0-9)*" against "00123" would produce
|
|
||||||
$1 = "00123"
|
$1 = "00123"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>If you think about it, had $1 only matched the "123", this would be "less good"
|
||||||
<p>If you think about it, had $1 only matched the "123", this would
|
than the match "00123" which is both further to the left and longer. If you
|
||||||
be "less good" than the match "00123" which is both further to the
|
want $1 to match only the "123" part, then you need to use something like:</p>
|
||||||
left and longer. If you want $1 to match only the "123" part, then
|
<pre>
|
||||||
you need to use something like:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
"0*([1-9][0-9]*)"
|
"0*([1-9][0-9]*)"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>as the expression.</p>
|
||||||
<p>as the expression.</p>
|
<p><font color="#ff0000">Q. Why don't character ranges work properly (POSIX mode
|
||||||
|
only)?</font><br>
|
||||||
<p><font color="#ff0000">Q. Why don't character ranges work
|
A. The POSIX standard specifies that character range expressions are locale
|
||||||
properly (POSIX mode only)?</font><br>
|
sensitive - so for example the expression [A-Z] will match any collating
|
||||||
A. The POSIX standard specifies that character range expressions
|
element that collates between 'A' and 'Z'. That means that for most locales
|
||||||
are locale sensitive - so for example the expression [A-Z] will
|
other than "C" or "POSIX", [A-Z] would match the single character 't' for
|
||||||
match any collating element that collates between 'A' and 'Z'. That
|
example, which is not what most people expect - or at least not what most
|
||||||
means that for most locales other than "C" or "POSIX", [A-Z] would
|
people have come to expect from regular expression engines. For this reason,
|
||||||
match the single character 't' for example, which is not what most
|
the default behaviour of boost.regex (perl mode) is to turn locale sensitive
|
||||||
people expect - or at least not what most people have come to
|
collation off by not setting the regex_constants::collate compile time flag.
|
||||||
expect from regular expression engines. For this reason, the
|
However if you set a non-default compile time flag - for example
|
||||||
default behaviour of boost.regex (perl mode) is to turn locale
|
regex_constants::extended or regex_constants::basic, then locale dependent
|
||||||
sensitive collation off by not setting the regex_constants::collate
|
collation will be enabled, this also applies to the POSIX API functions which
|
||||||
compile time flag. However if you set a non-default compile time
|
use either regex_constants::extended or regex_constants::basic internally. <i>[Note
|
||||||
flag - for example regex_constants::extended or
|
- when regex_constants::nocollate in effect, the library behaves "as if" the
|
||||||
regex_constants::basic, then locale dependent collation will be
|
LC_COLLATE locale category were always "C", regardless of what its actually set
|
||||||
enabled, this also applies to the POSIX API functions which use
|
to - end note</i>].</p>
|
||||||
either regex_constants::extended or regex_constants::basic
|
<p><font color="#ff0000">Q. Why are there no throw specifications on any of the
|
||||||
internally. <i>[Note - when regex_constants::nocollate in effect,
|
functions? What exceptions can the library throw?</font></p>
|
||||||
the library behaves "as if" the LC_COLLATE locale category were
|
<p>A. Not all compilers support (or honor) throw specifications, others support
|
||||||
always "C", regardless of what its actually set to - end
|
them but with reduced efficiency. Throw specifications may be added at a later
|
||||||
note</i>].</p>
|
date as compilers begin to handle this better. The library should throw only
|
||||||
|
three types of exception: boost::bad_expression can be thrown by basic_regex
|
||||||
<p><font color="#ff0000">Q. Why are there no throw specifications
|
when compiling a regular expression, std::runtime_error can be thrown when a
|
||||||
on any of the functions? What exceptions can the library
|
call to basic_regex::imbue tries to open a message catalogue that doesn't
|
||||||
throw?</font></p>
|
exist, or when a call to regex_search or regex_match results in an
|
||||||
|
"everlasting" search, or when a call to RegEx::GrepFiles or
|
||||||
<p>A. Not all compilers support (or honor) throw specifications,
|
RegEx::FindFiles tries to open a file that cannot be opened, finally
|
||||||
others support them but with reduced efficiency. Throw
|
std::bad_alloc can be thrown by just about any of the functions in this
|
||||||
specifications may be added at a later date as compilers begin to
|
library.</p>
|
||||||
handle this better. The library should throw only three types of
|
<p></p>
|
||||||
exception: boost::bad_expression can be thrown by basic_regex when
|
<hr>
|
||||||
compiling a regular expression, std::runtime_error can be thrown
|
|
||||||
when a call to basic_regex::imbue tries to open a message catalogue
|
|
||||||
that doesn't exist, or when a call to regex_search or regex_match
|
|
||||||
results in an "everlasting" search, or when a call to
|
|
||||||
RegEx::GrepFiles or RegEx::FindFiles tries to open a file that
|
|
||||||
cannot be opened, finally std::bad_alloc can be thrown by just
|
|
||||||
about any of the functions in this library.</p>
|
|
||||||
|
|
||||||
<p></p>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
character sequence. The behavior of the format flags is descibed in more
|
character sequence. The behavior of the format flags is descibed in more
|
||||||
detail in the <A href="format_syntax.html">format syntax guide</A>.</p>
|
detail in the <A href="format_syntax.html">format syntax guide</A>.</p>
|
||||||
<pre>
|
<pre>
|
||||||
namespace std{ namespace regex_constants{
|
namespace boost{ namespace regex_constants{
|
||||||
|
|
||||||
typedef bitmask_type match_flag_type;
|
typedef bitmask_type match_flag_type;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ static const match_flag_type format_first_only;
|
|||||||
static const match_flag_type format_all;
|
static const match_flag_type format_all;
|
||||||
|
|
||||||
} // namespace regex_constants
|
} // namespace regex_constants
|
||||||
} // namespace std
|
} // namespace boost
|
||||||
</pre>
|
</pre>
|
||||||
<h3>Description</h3>
|
<h3>Description</h3>
|
||||||
<p>The type <code>match_flag_type</code> is an implementation defined bitmask type
|
<p>The type <code>match_flag_type</code> is an implementation defined bitmask type
|
||||||
@@ -271,10 +271,10 @@ static const match_flag_type format_all;
|
|||||||
<br>
|
<br>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<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 --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ const_iterator end()const;
|
|||||||
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
|
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
|
||||||
marked sub-expression matches stored in *this.</p>
|
marked sub-expression matches stored in *this.</p>
|
||||||
<h4><A name="format"></A>match_results reformatting</h4>
|
<h4><A name="format"></A>match_results reformatting</h4>
|
||||||
<pre>template <class OutputIterator>
|
<pre><A name=m12></A>template <class OutputIterator>
|
||||||
OutputIterator format(OutputIterator out,
|
OutputIterator format(OutputIterator out,
|
||||||
const string_type& fmt,
|
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);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
|||||||
iterator first,
|
iterator first,
|
||||||
iterator last,
|
iterator last,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default)
|
boost::match_flag_type flags = match_default)
|
||||||
</pre>
|
</pre>
|
||||||
<p>The library also defines the following convenience versions, which take either
|
<p>The library also defines the following convenience versions, which take either
|
||||||
a const charT*, or a const std::basic_string<>& in place of a pair of
|
a const charT*, or a const std::basic_string<>& in place of a pair of
|
||||||
@@ -53,13 +53,13 @@
|
|||||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||||
<b>const</b> charT* str,
|
<b>const</b> charT* str,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
|
|
||||||
<b>template</b> <<b>class</b> Predicate, <b>class</b> ST, <b>class</b> SA, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits>
|
<b>template</b> <<b>class</b> Predicate, <b>class</b> ST, <b>class</b> SA, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits>
|
||||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||||
<b>const</b> std::basic_string<charT, ST, SA>& s,
|
<b>const</b> std::basic_string<charT, ST, SA>& s,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
</pre>
|
</pre>
|
||||||
<p>The parameters for the primary version of regex_grep have the following
|
<p>The parameters for the primary version of regex_grep have the following
|
||||||
meanings: </p>
|
meanings: </p>
|
||||||
@@ -370,11 +370,10 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
|
|||||||
<hr>
|
<hr>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ void</B> IndexClasses(map_type& m, <B>const</B> std::string& file)
|
|||||||
start = file.begin();
|
start = file.begin();
|
||||||
end = file.end();
|
end = file.end();
|
||||||
boost::<a href="match_results.html">match_results</a><std::string::const_iterator> what;
|
boost::<a href="match_results.html">match_results</a><std::string::const_iterator> what;
|
||||||
<B>unsigned</B> <B>int</B> flags = boost::match_default;
|
boost::match_flag_type flags = boost::match_default;
|
||||||
<B>while</B>(regex_search(start, end, what, expression, flags))
|
<B>while</B>(regex_search(start, end, what, expression, flags))
|
||||||
{
|
{
|
||||||
<FONT color=#000080> <I>// what[0] contains the whole string
|
<FONT color=#000080> <I>// what[0] contains the whole string
|
||||||
@@ -314,11 +314,10 @@ void</B> IndexClasses(map_type& m, <B>const</B> std::string& file)
|
|||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -38,15 +38,15 @@
|
|||||||
<PRE><B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
<PRE><B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||||
<B> unsigned</B> flags,
|
<STRONG> </STRONG>boost::match_flag_type flags,
|
||||||
std::size_t max_split);
|
std::size_t max_split);
|
||||||
|
|
||||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||||
<B>unsigned</B> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
|
|
||||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1>
|
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
@@ -134,11 +134,10 @@ boost::regex e(<FONT color=#000080>"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)
|
|||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ typedef regex_token_iterator<const char*> cregex_token_i
|
|||||||
typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
|
typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
|
||||||
#ifndef BOOST_NO_WREGEX
|
#ifndef BOOST_NO_WREGEX
|
||||||
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
||||||
typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_iterator;
|
typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_iterator;
|
||||||
#endif
|
#endif
|
||||||
</PRE>
|
</PRE>
|
||||||
<H3><A name="description"></A>Description</H3>
|
<H3><A name="description"></A>Description</H3>
|
||||||
@@ -84,7 +84,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
<P><B> Effects:</B> constructs an end of sequence iterator.</P>
|
<P><B> Effects:</B> constructs an end of sequence iterator.</P>
|
||||||
<PRE><A name=c2></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
<PRE><A name=c2></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
int submatch = 0, match_flag_type m = match_default);</PRE>
|
int submatch = 0, match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>. Object re shall exist
|
||||||
|
for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate one
|
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate one
|
||||||
string for each regular expression match of the expression <EM>re</EM> found
|
string for each regular expression match of the expression <EM>re</EM> found
|
||||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. The
|
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. The
|
||||||
@@ -99,7 +100,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
configured</A> in non-recursive mode).</P>
|
configured</A> in non-recursive mode).</P>
|
||||||
<PRE><A name=c3></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
<PRE><A name=c3></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
const std::vector<int>& submatches, match_flag_type m = match_default);</PRE>
|
const std::vector<int>& submatches, match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions:</B> <CODE>submatches.size() && !re.empty()</CODE>.</P>
|
<P><B> Preconditions:</B> <CODE>submatches.size() && !re.empty()</CODE>.
|
||||||
|
Object re shall exist for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate <EM>submatches.size()</EM>
|
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate <EM>submatches.size()</EM>
|
||||||
strings for each regular expression match of the expression <EM>re</EM> found
|
strings for each regular expression match of the expression <EM>re</EM> found
|
||||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. For
|
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. For
|
||||||
@@ -118,7 +120,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
<PRE><A name=c4></A>template <std::size_t N>
|
<PRE><A name=c4></A>template <std::size_t N>
|
||||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
const int (&submatches)[R], match_flag_type m = match_default);</PRE>
|
const int (&submatches)[R], match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>. Object re shall exist
|
||||||
|
for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><STRONG>Effects:</STRONG></B> constructs a regex_token_iterator that will
|
<P><STRONG>Effects:</STRONG></B> constructs a regex_token_iterator that will
|
||||||
enumerate <EM>R</EM> strings for each regular expression match of the
|
enumerate <EM>R</EM> strings for each regular expression match of the
|
||||||
expression <EM>re</EM> found within the sequence <EM>[a,b)</EM>, using match
|
expression <EM>re</EM> found within the sequence <EM>[a,b)</EM>, using match
|
||||||
|
|||||||
@@ -24,10 +24,12 @@
|
|||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p></p>
|
<p></p>
|
||||||
<P>Under construction.</P>
|
<P>
|
||||||
<P>The current boost.regex traits class design will be migrated to that specified
|
Under construction: the current design will be replaced by that specified in
|
||||||
in the <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
|
the <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
|
||||||
expression standardization proposal</A>. </P>
|
expression standardization proposal</A>, the current (obsolete) design has
|
||||||
|
it's <A href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/boost/boost/libs/regex/Attic/traits_class_ref.htm?rev=1.11">
|
||||||
|
documentation archived online</A>.</P>
|
||||||
<P>
|
<P>
|
||||||
<HR>
|
<HR>
|
||||||
<P></P>
|
<P></P>
|
||||||
@@ -36,11 +38,9 @@
|
|||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -91,18 +91,18 @@
|
|||||||
<P>Parentheses serve two purposes, to group items together into a sub-expression,
|
<P>Parentheses serve two purposes, to group items together into a sub-expression,
|
||||||
and to mark what generated the match. For example the expression "(ab)*" would
|
and to mark what generated the match. For example the expression "(ab)*" would
|
||||||
match all of the string "ababab". The matching algorithms <A href="regex_match.html">
|
match all of the string "ababab". The matching algorithms <A href="regex_match.html">
|
||||||
regex_match</A> and <A href="regex_search.html">regex_search</A>
|
regex_match</A> and <A href="regex_search.html">regex_search</A> each take
|
||||||
each take an instance of <A href="match_results.html">match_results</A>
|
an instance of <A href="match_results.html">match_results</A> that reports what
|
||||||
that reports what caused the match, on exit from these functions the <A href="match_results.html">
|
caused the match, on exit from these functions the <A href="match_results.html">match_results</A>
|
||||||
match_results</A> contains information both on what the whole expression
|
contains information both on what the whole expression matched and on what each
|
||||||
matched and on what each sub-expression matched. In the example above
|
sub-expression matched. In the example above match_results[1] would contain a
|
||||||
match_results[1] would contain a pair of iterators denoting the final "ab" of
|
pair of iterators denoting the final "ab" of the matching string. It is
|
||||||
the matching string. It is permissible for sub-expressions to match null
|
permissible for sub-expressions to match null strings. If a sub-expression
|
||||||
strings. If a sub-expression takes no part in a match - for example if it is
|
takes no part in a match - for example if it is part of an alternative that is
|
||||||
part of an alternative that is not taken - then both of the iterators that are
|
not taken - then both of the iterators that are returned for that
|
||||||
returned for that sub-expression point to the end of the input string, and the <I>matched</I>
|
sub-expression point to the end of the input string, and the <I>matched</I> parameter
|
||||||
parameter for that sub-expression is <I>false</I>. Sub-expressions are indexed
|
for that sub-expression is <I>false</I>. Sub-expressions are indexed from left
|
||||||
from left to right starting from 1, sub-expression 0 is the whole expression.
|
to right starting from 1, sub-expression 0 is the whole expression.
|
||||||
</P>
|
</P>
|
||||||
<H3>Non-Marking Parenthesis
|
<H3>Non-Marking Parenthesis
|
||||||
</H3>
|
</H3>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<P>A set is a set of characters that can match any single character that is a
|
<P>A set is a set of characters that can match any single character that is a
|
||||||
member of the set. Sets are delimited by "[" and "]" and can contain literals,
|
member of the set. Sets are delimited by "[" and "]" and can contain literals,
|
||||||
character ranges, character classes, collating elements and equivalence
|
character ranges, character classes, collating elements and equivalence
|
||||||
classes. Set declarations that start with "^" contain the compliment of the
|
classes. Set declarations that start with "^" contain the complement of the
|
||||||
elements that follow.
|
elements that follow.
|
||||||
</P>
|
</P>
|
||||||
<P>Examples:
|
<P>Examples:
|
||||||
@@ -293,7 +293,7 @@
|
|||||||
[^[.ae.]] would only match one character.
|
[^[.ae.]] would only match one character.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
Equivalence classes take the general form[=tagname=] inside a set declaration,
|
Equivalence classes take the generalform[=tagname=] inside a set declaration,
|
||||||
where <I>tagname</I> is either a single character, or a name of a collating
|
where <I>tagname</I> is either a single character, or a name of a collating
|
||||||
element, and matches any character that is a member of the same primary
|
element, and matches any character that is a member of the same primary
|
||||||
equivalence class as the collating element [.tagname.]. An equivalence class is
|
equivalence class as the collating element [.tagname.]. An equivalence class is
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
typically collated by character, then by accent, and then by case; the primary
|
typically collated by character, then by accent, and then by case; the primary
|
||||||
sort key then relates to the character, the secondary to the accentation, and
|
sort key then relates to the character, the secondary to the accentation, and
|
||||||
the tertiary to the case). If there is no equivalence class corresponding to <I>tagname</I>
|
the tertiary to the case). If there is no equivalence class corresponding to <I>tagname</I>
|
||||||
, then[=tagname=] is exactly the same as [.tagname.]. Unfortunately there is no
|
,then[=tagname=] is exactly the same as [.tagname.]. Unfortunately there is no
|
||||||
locale independent method of obtaining the primary sort key for a character,
|
locale independent method of obtaining the primary sort key for a character,
|
||||||
except under Win32. For other operating systems the library will "guess" the
|
except under Win32. For other operating systems the library will "guess" the
|
||||||
primary sort key from the full sort key (obtained from <I>strxfrm</I>), so
|
primary sort key from the full sort key (obtained from <I>strxfrm</I>), so
|
||||||
@@ -666,106 +666,103 @@
|
|||||||
<H3>What gets matched?
|
<H3>What gets matched?
|
||||||
</H3>
|
</H3>
|
||||||
<P>
|
<P>
|
||||||
When the expression is compiled as a Perl-compatible regex then the matching
|
When the expression is compiled as a Perl-compatible regex then the matching
|
||||||
algorithms will perform a depth first search on the state machine and report
|
algorithms will perform a depth first search on the state machine and report
|
||||||
the first match found.</P>
|
the first match found.</P>
|
||||||
<P>
|
<P>
|
||||||
When the expression is compiled as a POSIX-compatible regex then the matching
|
When the expression is compiled as a POSIX-compatible regex then the matching
|
||||||
algorithms will match the first possible matching string, if more than one
|
algorithms will match the first possible matching string, if more than one
|
||||||
string starting at a given location can match then it matches the longest
|
string starting at a given location can match then it matches the longest
|
||||||
possible string, unless the flag match_any is set, in which case the first
|
possible string, unless the flag match_any is set, in which case the first
|
||||||
match encountered is returned. Use of the match_any option can reduce the time
|
match encountered is returned. Use of the match_any option can reduce the time
|
||||||
taken to find the match - but is only useful if the user is less concerned
|
taken to find the match - but is only useful if the user is less concerned
|
||||||
about what matched - for example it would not be suitable for search and
|
about what matched - for example it would not be suitable for search and
|
||||||
replace operations. In cases where their are multiple possible matches all
|
replace operations. In cases where their are multiple possible matches all
|
||||||
starting at the same location, and all of the same length, then the match
|
starting at the same location, and all of the same length, then the match
|
||||||
chosen is the one with the longest first sub-expression, if that is the same
|
chosen is the one with the longest first sub-expression, if that is the same
|
||||||
for two or more matches, then the second sub-expression will be examined and so
|
for two or more matches, then the second sub-expression will be examined and so
|
||||||
on.
|
on.
|
||||||
</P><P>
|
|
||||||
The following table examples illustrate the main differences between Perl and
|
|
||||||
POSIX regular expression matching rules:
|
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
<TABLE id="Table5" cellSpacing="1" cellPadding="7" width="624" border="1">
|
The following table examples illustrate the main differences between Perl and
|
||||||
<TBODY>
|
POSIX regular expression matching rules:
|
||||||
<TR>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>Expression</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>Text</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>POSIX leftmost longest match</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>ECMAScript depth first search match</P>
|
|
||||||
</TD>
|
|
||||||
</TR>
|
|
||||||
<TR>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P><CODE>a|ab</CODE></P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P><CODE>
|
|
||||||
xaby</CODE>
|
|
||||||
</P>
|
</P>
|
||||||
</TD>
|
<P>
|
||||||
<TD vAlign="top" width="25%">
|
<TABLE id="Table5" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||||
<P><CODE>
|
<TBODY>
|
||||||
"ab"</CODE></P></TD>
|
<TR>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P>Expression</P>
|
||||||
"a"</CODE></P></TD>
|
</TD>
|
||||||
</TR>
|
<TD vAlign="top" width="25%">
|
||||||
<TR>
|
<P>Text</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P><CODE>
|
<TD vAlign="top" width="25%">
|
||||||
.*([[:alnum:]]+).*</CODE></P></TD>
|
<P>POSIX leftmost longest match</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P><CODE>
|
<TD vAlign="top" width="25%">
|
||||||
" abc def xyz "</CODE></P></TD>
|
<P>ECMAScript depth first search match</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P>$0 = " abc def xyz "<BR>
|
</TR>
|
||||||
$1 = "abc"</P>
|
<TR>
|
||||||
</TD>
|
<TD vAlign="top" width="25%">
|
||||||
<TD vAlign="top" width="25%">
|
<P><CODE>a|ab</CODE></P>
|
||||||
<P>$0 = " abc def xyz "<BR>
|
</TD>
|
||||||
$1 = "z"</P>
|
<TD vAlign="top" width="25%">
|
||||||
</TD>
|
<P><CODE> xaby</CODE>
|
||||||
</TR>
|
</P>
|
||||||
<TR>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P><CODE> "ab"</CODE></P>
|
||||||
.*(a|xayy)</CODE></P></TD>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P><CODE> "a"</CODE></P>
|
||||||
zzxayyzz</CODE></P></TD>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
</TR>
|
||||||
<P><CODE>
|
<TR>
|
||||||
"zzxayy"</CODE></P></TD>
|
<TD vAlign="top" width="25%">
|
||||||
<TD vAlign="top" width="25%">
|
<P><CODE> .*([[:alnum:]]+).*</CODE></P>
|
||||||
<P><CODE>"zzxa"</CODE></P>
|
</TD>
|
||||||
</TD>
|
<TD vAlign="top" width="25%">
|
||||||
</TR>
|
<P><CODE> " abc def xyz "</CODE></P>
|
||||||
</TBODY></CODE></TD></TR></TABLE>
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P>$0 = " abc def xyz "<BR>
|
||||||
|
$1 = "abc"</P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P>$0 = " abc def xyz "<BR>
|
||||||
|
$1 = "z"</P>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
<TR>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> .*(a|xayy)</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> zzxayyzz</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> "zzxayy"</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE>"zzxa"</CODE></P>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</TBODY></CODE></TD></TR></TABLE>
|
||||||
<P>These differences between Perl matching rules, and POSIX matching rules, mean
|
<P>These differences between Perl matching rules, and POSIX matching rules, mean
|
||||||
that these two regular expression syntaxes differ not only in the features
|
that these two regular expression syntaxes differ not only in the features
|
||||||
offered, but also in the form that the state machine takes and/or the
|
offered, but also in the form that the state machine takes and/or the
|
||||||
algorithms used to traverse the state machine.</p>
|
algorithms used to traverse the state machine.</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p></p>
|
<p></p>
|
||||||
|
<P>Captures are the iterator ranges that are "captured" by marked sub-expressions
|
||||||
|
as a regular expression gets matched. Each marked sub-expression can
|
||||||
|
result in more than one capture, if it is matched more than once. This
|
||||||
|
document explains how captures and marked sub-expressions in Boost.Regex are
|
||||||
|
represented and accessed.</P>
|
||||||
<H2>Marked sub-expressions</H2>
|
<H2>Marked sub-expressions</H2>
|
||||||
<P>Every time a Perl regular expression contains a parenthesis group (), it spits
|
<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
|
out an extra field, known as a marked sub-expression, for example the
|
||||||
@@ -247,4 +252,3 @@ Text: "now is the time for all good men to come to the aid of the party"
|
|||||||
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -25,25 +25,32 @@
|
|||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<HR>
|
<HR>
|
||||||
<P>The author can be contacted at john@johnmaddock.co.uk; the
|
<P>The author can be contacted at john@johnmaddock.co.uk; the home page for
|
||||||
home page for this library is at <A href="http://www.boost.org">www.boost.org</A>.</P>
|
this library is at <A href="http://www.boost.org">www.boost.org</A>.</P>
|
||||||
<P>I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think
|
<P>I am indebted to <A href="http://www.cs.princeton.edu/~rs/">Robert Sedgewick's
|
||||||
about algorithms and their performance, and to the folks at boost for forcing
|
"Algorithms in C++" </A>for forcing me to think about algorithms and their
|
||||||
me to <I>think</I>, period. The following people have all contributed useful
|
performance, and to the folks at <A href="http://www.boost.org">boost</A> for
|
||||||
comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
|
forcing me to <I>think</I>, period.</P>
|
||||||
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David Bergman, David
|
<P><A href="http://www.boost-consulting.com">Eric Niebler</A>, author of the <A href="http://research.microsoft.com/projects/greta">
|
||||||
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias
|
GRETA regular expression component</A>, has shared several important ideas,
|
||||||
Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones,
|
in a series of long discussions.</P>
|
||||||
Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens
|
<P>Pete Becker, of <A href="http://www.dinkumware.com/">Dinkumware Ltd</A>, has
|
||||||
Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
|
helped enormously with the standardisation proposal language.</P>
|
||||||
Smith, Mike Smyth, Alexander Sokolovsky, Herv<72> Poirier, Michael Raykh, Marc
|
<P>The following people have all contributed useful comments or fixes: Dave
|
||||||
Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
|
Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, Jan B<>lsche,
|
||||||
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals
|
Beman Dawes, Paul Baxter, David Bergman, David Dennerline, Edward Diener, Peter
|
||||||
supplied with the Henry Spencer, Perl and GNU regular expression libraries -
|
Dimov, Robert Dunn, Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc Gregoire,
|
||||||
wherever possible I have tried to maintain compatibility with these libraries
|
Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
|
||||||
and with the POSIX standard - the code however is entirely my own, including
|
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt,
|
||||||
any bugs! I can absolutely guarantee that I will not fix any bugs I don't know
|
Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander Sokolovsky,
|
||||||
about, so if you have any comments or spot any bugs, please get in touch.</P>
|
Herv<EFBFBD> Poirier, Michael Raykh, Marc Recht, Scott VanCamp, Bruno Voigt, Alexey
|
||||||
|
Voinov, Jerry Waldorf, Rob Ward, Lealon Watts, John Wismar, Thomas Witt and
|
||||||
|
Yuval Yosef. I am also grateful to the manuals supplied with the Henry Spencer,
|
||||||
|
Perl and GNU regular expression libraries - wherever possible I have tried to
|
||||||
|
maintain compatibility with these libraries and with the POSIX standard - the
|
||||||
|
code however is entirely my own, including any bugs! I can absolutely guarantee
|
||||||
|
that I will not fix any bugs I don't know about, so if you have any comments or
|
||||||
|
spot any bugs, please get in touch.</P>
|
||||||
<P>Useful further information can be found at:</P>
|
<P>Useful further information can be found at:</P>
|
||||||
<P>Short tutorials on regular expressions can be <A href="http://etext.lib.virginia.edu/helpsheets/regex.html">
|
<P>Short tutorials on regular expressions can be <A href="http://etext.lib.virginia.edu/helpsheets/regex.html">
|
||||||
found here</A> and <A href="http://www.devshed.com/Server_Side/Administration/RegExp/page1.html">here</A>.</P>
|
found here</A> and <A href="http://www.devshed.com/Server_Side/Administration/RegExp/page1.html">here</A>.</P>
|
||||||
@@ -72,8 +79,7 @@
|
|||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
229
doc/faq.html
229
doc/faq.html
@@ -1,153 +1,114 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
<title>Boost.Regex: FAQ</title>
|
||||||
<title>Boost.Regex: FAQ</title>
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||||
<meta http-equiv="Content-Type" content=
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
"text/html; charset=iso-8859-1">
|
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body>
|
<p></p>
|
||||||
<p></p>
|
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
|
||||||
|
<tr>
|
||||||
<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
|
<td valign="top" width="300">
|
||||||
border="0">
|
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
||||||
<tr>
|
</td>
|
||||||
<td valign="top" width="300">
|
<td width="353">
|
||||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
|
<h1 align="center">Boost.Regex</h1>
|
||||||
"C++ Boost" src="../../../c++boost.gif" border="0"></a></h3>
|
<h2 align="center">FAQ</h2>
|
||||||
</td>
|
</td>
|
||||||
<td width="353">
|
<td width="50">
|
||||||
<h1 align="center">Boost.Regex</h1>
|
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
||||||
|
</td>
|
||||||
<h2 align="center">FAQ</h2>
|
</tr>
|
||||||
</td>
|
</table>
|
||||||
<td width="50">
|
<br>
|
||||||
<h3><a href="index.html"><img height="45" width="43" alt=
|
<br>
|
||||||
"Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
|
<hr>
|
||||||
</td>
|
<font color="#ff0000"><font color="#ff0000"></font></font>
|
||||||
</tr>
|
<p><font color="#ff0000"><font color="#ff0000"><font color="#ff0000"> Q. Why can't I
|
||||||
</table>
|
use the "convenience" versions of regex_match / regex_search / regex_grep /
|
||||||
|
regex_format / regex_merge?</font></font></font></p>
|
||||||
<br>
|
<p>A. These versions may or may not be available depending upon the capabilities
|
||||||
<br>
|
of your compiler, the rules determining the format of these functions are quite
|
||||||
|
complex - and only the versions visible to a standard compliant compiler are
|
||||||
|
given in the help. To find out what your compiler supports, run
|
||||||
<hr>
|
<boost/regex.hpp> through your C++ pre-processor, and search the output
|
||||||
<font color="#ff0000"><font color="#ff0000"></font></font>
|
file for the function that you are interested in.<font color="#ff0000"><font color="#ff0000"></font></font></p>
|
||||||
<p><font color="#ff0000"><font color="#ff0000"><font color=
|
<p><font color="#ff0000"><font color="#ff0000">Q. I can't get regex++ to work with
|
||||||
"#ff0000"> Q. Why can't I use the "convenience" versions of
|
escape characters, what's going on?</font></font></p>
|
||||||
regex_match / regex_search / regex_grep / regex_format /
|
<p>A. If you embed regular expressions in C++ code, then remember that escape
|
||||||
regex_merge?</font></font></font></p>
|
characters are processed twice: once by the C++ compiler, and once by the
|
||||||
|
regex++ expression compiler, so to pass the regular expression \d+ to regex++,
|
||||||
<p>A. These versions may or may not be available depending upon the
|
you need to embed "\\d+" in your code. Likewise to match a literal backslash
|
||||||
capabilities of your compiler, the rules determining the format of
|
you will need to embed "\\\\" in your code. <font color="#ff0000"></font>
|
||||||
these functions are quite complex - and only the versions visible
|
</p>
|
||||||
to a standard compliant compiler are given in the help. To find out
|
<p><font color="#ff0000">Q. Why does using parenthesis in a POSIX regular expression
|
||||||
what your compiler supports, run <boost/regex.hpp> through
|
change the result of a match?</font></p>
|
||||||
your C++ pre-processor, and search the output file for the function
|
<p>For POSIX (extended and basic) regular expressions, but not for perl regexes,
|
||||||
that you are interested in.<font color="#ff0000"><font color=
|
parentheses don't only mark; they determine what the best match is as well.
|
||||||
"#ff0000"></font></font></p>
|
When the expression is compiled as a POSIX basic or extended regex then
|
||||||
|
Boost.regex follows the POSIX standard leftmost longest rule for determining
|
||||||
<p><font color="#ff0000"><font color="#ff0000">Q. I can't get
|
what matched. So if there is more than one possible match after considering the
|
||||||
regex++ to work with escape characters, what's going
|
whole expression, it looks next at the first sub-expression and then the second
|
||||||
on?</font></font></p>
|
sub-expression and so on. So...</p>
|
||||||
|
<pre>
|
||||||
<p>A. If you embed regular expressions in C++ code, then remember
|
|
||||||
that escape characters are processed twice: once by the C++
|
|
||||||
compiler, and once by the regex++ expression compiler, so to pass
|
|
||||||
the regular expression \d+ to regex++, you need to embed "\\d+" in
|
|
||||||
your code. Likewise to match a literal backslash you will need to
|
|
||||||
embed "\\\\" in your code. <font color="#ff0000"></font></p>
|
|
||||||
|
|
||||||
<p><font color="#ff0000">Q. Why does using parenthesis in a POSIX
|
|
||||||
regular expression change the result of a match?</font></p>
|
|
||||||
|
|
||||||
<p>For POSIX (extended and basic) regular expressions, but not for
|
|
||||||
perl regexes, parentheses don't only mark; they determine what the
|
|
||||||
best match is as well. When the expression is compiled as a POSIX
|
|
||||||
basic or extended regex then Boost.regex follows the POSIX standard
|
|
||||||
leftmost longest rule for determining what matched. So if there is
|
|
||||||
more than one possible match after considering the whole
|
|
||||||
expression, it looks next at the first sub-expression and then the
|
|
||||||
second sub-expression and so on. So...</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
"(0*)([0-9]*)" against "00123" would produce
|
"(0*)([0-9]*)" against "00123" would produce
|
||||||
$1 = "00"
|
$1 = "00"
|
||||||
$2 = "123"
|
$2 = "123"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>where as</p>
|
||||||
<p>where as</p>
|
<pre>
|
||||||
|
"0*([0-9])*" against "00123" would produce
|
||||||
<pre>
|
|
||||||
"0*([0-9)*" against "00123" would produce
|
|
||||||
$1 = "00123"
|
$1 = "00123"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>If you think about it, had $1 only matched the "123", this would be "less good"
|
||||||
<p>If you think about it, had $1 only matched the "123", this would
|
than the match "00123" which is both further to the left and longer. If you
|
||||||
be "less good" than the match "00123" which is both further to the
|
want $1 to match only the "123" part, then you need to use something like:</p>
|
||||||
left and longer. If you want $1 to match only the "123" part, then
|
<pre>
|
||||||
you need to use something like:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
"0*([1-9][0-9]*)"
|
"0*([1-9][0-9]*)"
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>as the expression.</p>
|
||||||
<p>as the expression.</p>
|
<p><font color="#ff0000">Q. Why don't character ranges work properly (POSIX mode
|
||||||
|
only)?</font><br>
|
||||||
<p><font color="#ff0000">Q. Why don't character ranges work
|
A. The POSIX standard specifies that character range expressions are locale
|
||||||
properly (POSIX mode only)?</font><br>
|
sensitive - so for example the expression [A-Z] will match any collating
|
||||||
A. The POSIX standard specifies that character range expressions
|
element that collates between 'A' and 'Z'. That means that for most locales
|
||||||
are locale sensitive - so for example the expression [A-Z] will
|
other than "C" or "POSIX", [A-Z] would match the single character 't' for
|
||||||
match any collating element that collates between 'A' and 'Z'. That
|
example, which is not what most people expect - or at least not what most
|
||||||
means that for most locales other than "C" or "POSIX", [A-Z] would
|
people have come to expect from regular expression engines. For this reason,
|
||||||
match the single character 't' for example, which is not what most
|
the default behaviour of boost.regex (perl mode) is to turn locale sensitive
|
||||||
people expect - or at least not what most people have come to
|
collation off by not setting the regex_constants::collate compile time flag.
|
||||||
expect from regular expression engines. For this reason, the
|
However if you set a non-default compile time flag - for example
|
||||||
default behaviour of boost.regex (perl mode) is to turn locale
|
regex_constants::extended or regex_constants::basic, then locale dependent
|
||||||
sensitive collation off by not setting the regex_constants::collate
|
collation will be enabled, this also applies to the POSIX API functions which
|
||||||
compile time flag. However if you set a non-default compile time
|
use either regex_constants::extended or regex_constants::basic internally. <i>[Note
|
||||||
flag - for example regex_constants::extended or
|
- when regex_constants::nocollate in effect, the library behaves "as if" the
|
||||||
regex_constants::basic, then locale dependent collation will be
|
LC_COLLATE locale category were always "C", regardless of what its actually set
|
||||||
enabled, this also applies to the POSIX API functions which use
|
to - end note</i>].</p>
|
||||||
either regex_constants::extended or regex_constants::basic
|
<p><font color="#ff0000">Q. Why are there no throw specifications on any of the
|
||||||
internally. <i>[Note - when regex_constants::nocollate in effect,
|
functions? What exceptions can the library throw?</font></p>
|
||||||
the library behaves "as if" the LC_COLLATE locale category were
|
<p>A. Not all compilers support (or honor) throw specifications, others support
|
||||||
always "C", regardless of what its actually set to - end
|
them but with reduced efficiency. Throw specifications may be added at a later
|
||||||
note</i>].</p>
|
date as compilers begin to handle this better. The library should throw only
|
||||||
|
three types of exception: boost::bad_expression can be thrown by basic_regex
|
||||||
<p><font color="#ff0000">Q. Why are there no throw specifications
|
when compiling a regular expression, std::runtime_error can be thrown when a
|
||||||
on any of the functions? What exceptions can the library
|
call to basic_regex::imbue tries to open a message catalogue that doesn't
|
||||||
throw?</font></p>
|
exist, or when a call to regex_search or regex_match results in an
|
||||||
|
"everlasting" search, or when a call to RegEx::GrepFiles or
|
||||||
<p>A. Not all compilers support (or honor) throw specifications,
|
RegEx::FindFiles tries to open a file that cannot be opened, finally
|
||||||
others support them but with reduced efficiency. Throw
|
std::bad_alloc can be thrown by just about any of the functions in this
|
||||||
specifications may be added at a later date as compilers begin to
|
library.</p>
|
||||||
handle this better. The library should throw only three types of
|
<p></p>
|
||||||
exception: boost::bad_expression can be thrown by basic_regex when
|
<hr>
|
||||||
compiling a regular expression, std::runtime_error can be thrown
|
|
||||||
when a call to basic_regex::imbue tries to open a message catalogue
|
|
||||||
that doesn't exist, or when a call to regex_search or regex_match
|
|
||||||
results in an "everlasting" search, or when a call to
|
|
||||||
RegEx::GrepFiles or RegEx::FindFiles tries to open a file that
|
|
||||||
cannot be opened, finally std::bad_alloc can be thrown by just
|
|
||||||
about any of the functions in this library.</p>
|
|
||||||
|
|
||||||
<p></p>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,10 @@
|
|||||||
<dl class="index">
|
<dl class="index">
|
||||||
<dt><a href="syntax_option_type.html">syntax_option_type</a></dt> <dt><a href="match_flag_type.html">
|
<dt><a href="syntax_option_type.html">syntax_option_type</a></dt> <dt><a href="match_flag_type.html">
|
||||||
match_flag_type</a></dt> <dt><a href="bad_expression.html">class bad_expression</a></dt>
|
match_flag_type</a></dt> <dt><a href="bad_expression.html">class bad_expression</a></dt>
|
||||||
<dt><a href="regex_traits.html">class regex_traits</a></dt> <dt><a href="basic_regex.html">
|
<dt><a href="regex_traits.html">class regex_traits</a></dt>
|
||||||
class template basic_regex</a></dt> <dt><a href="sub_match.html">class template
|
<dt><a href="basic_regex.html">class template basic_regex</a></dt>
|
||||||
sub_match</a></dt> <dt><a href="match_results.html">class template
|
<dt><a href="sub_match.html">class template sub_match</a></dt>
|
||||||
match_results</a></dt>
|
<dt><a href="match_results.html">class template match_results</a></dt>
|
||||||
</dl>
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>Algorithms</dt>
|
<dt>Algorithms</dt>
|
||||||
@@ -66,6 +66,25 @@
|
|||||||
<dt><a href="regex_token_iterator.html">regex_token_iterator</a></dt>
|
<dt><a href="regex_token_iterator.html">regex_token_iterator</a></dt>
|
||||||
</dl>
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>Typedefs</dt>
|
||||||
|
<dd>
|
||||||
|
<dl class="index">
|
||||||
|
<dt><a href="basic_regex.html">regex</a> [ = basic_regex<char> ]</dt>
|
||||||
|
<dt><a href="basic_regex.html">wregex</a> [ = basic_regex<wchar_t> ]</dt>
|
||||||
|
<dt><a href="match_results.html">cmatch</a> [ = match_results<const char*> ]</dt>
|
||||||
|
<dt><a href="match_results.html">wcmatch</a> [ = match_results<const wchar_t*> ]</dt>
|
||||||
|
<dt><a href="match_results.html">smatch</a> [ = match_results<std::string::const_iterator> ]</dt>
|
||||||
|
<dt><a href="match_results.html">wsmatch</a> [ = match_results<std::wstring::const_iterator> ]</dt>
|
||||||
|
<dt><a href="regex_iterator.html">cregex_iterator</a> [ = regex_iterator<const char*>]</dt>
|
||||||
|
<dt><a href="regex_iterator.html">wcregex_iterator</a> [ = regex_iterator<const wchar_t*>]</dt>
|
||||||
|
<dt><a href="regex_iterator.html">sregex_iterator</a> [ = regex_iterator<std::string::const_iterator>]</dt>
|
||||||
|
<dt><a href="regex_iterator.html">wsregex_iterator</a> [ = regex_iterator<std::wstring::const_iterator>]</dt>
|
||||||
|
<dt><a href="regex_token_iterator.html">cregex_token_iterator</a> [ = regex_token_iterator<const char*>]</dt>
|
||||||
|
<dt><a href="regex_token_iterator.html">wcregex_token_iterator</a> [ = regex_token_iterator<const wchar_t*>]</dt>
|
||||||
|
<dt><a href="regex_token_iterator.html">sregex_token_iterator</a> [ = regex_token_iterator<std::string::const_iterator>]</dt>
|
||||||
|
<dt><a href="regex_token_iterator.html">wsregex_token_iterator</a> [ = regex_token_iterator<std::wstring::const_iterator>]</dt>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
<dt>Misc.</dt>
|
<dt>Misc.</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<dl class="index">
|
<dl class="index">
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
character sequence. The behavior of the format flags is descibed in more
|
character sequence. The behavior of the format flags is descibed in more
|
||||||
detail in the <A href="format_syntax.html">format syntax guide</A>.</p>
|
detail in the <A href="format_syntax.html">format syntax guide</A>.</p>
|
||||||
<pre>
|
<pre>
|
||||||
namespace std{ namespace regex_constants{
|
namespace boost{ namespace regex_constants{
|
||||||
|
|
||||||
typedef bitmask_type match_flag_type;
|
typedef bitmask_type match_flag_type;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ static const match_flag_type format_first_only;
|
|||||||
static const match_flag_type format_all;
|
static const match_flag_type format_all;
|
||||||
|
|
||||||
} // namespace regex_constants
|
} // namespace regex_constants
|
||||||
} // namespace std
|
} // namespace boost
|
||||||
</pre>
|
</pre>
|
||||||
<h3>Description</h3>
|
<h3>Description</h3>
|
||||||
<p>The type <code>match_flag_type</code> is an implementation defined bitmask type
|
<p>The type <code>match_flag_type</code> is an implementation defined bitmask type
|
||||||
@@ -271,10 +271,10 @@ static const match_flag_type format_all;
|
|||||||
<br>
|
<br>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<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 --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ const_iterator end()const;
|
|||||||
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
|
<p><b>Effects:</b> Returns a terminating iterator that enumerates over all the
|
||||||
marked sub-expression matches stored in *this.</p>
|
marked sub-expression matches stored in *this.</p>
|
||||||
<h4><A name="format"></A>match_results reformatting</h4>
|
<h4><A name="format"></A>match_results reformatting</h4>
|
||||||
<pre>template <class OutputIterator>
|
<pre><A name=m12></A>template <class OutputIterator>
|
||||||
OutputIterator format(OutputIterator out,
|
OutputIterator format(OutputIterator out,
|
||||||
const string_type& fmt,
|
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);
|
||||||
|
|||||||
998
doc/regex.html
998
doc/regex.html
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@
|
|||||||
iterator first,
|
iterator first,
|
||||||
iterator last,
|
iterator last,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default)
|
boost::match_flag_type flags = match_default)
|
||||||
</pre>
|
</pre>
|
||||||
<p>The library also defines the following convenience versions, which take either
|
<p>The library also defines the following convenience versions, which take either
|
||||||
a const charT*, or a const std::basic_string<>& in place of a pair of
|
a const charT*, or a const std::basic_string<>& in place of a pair of
|
||||||
@@ -53,13 +53,13 @@
|
|||||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||||
<b>const</b> charT* str,
|
<b>const</b> charT* str,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
|
|
||||||
<b>template</b> <<b>class</b> Predicate, <b>class</b> ST, <b>class</b> SA, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits>
|
<b>template</b> <<b>class</b> Predicate, <b>class</b> ST, <b>class</b> SA, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits>
|
||||||
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
<b>unsigned</b> <b>int</b> regex_grep(Predicate foo,
|
||||||
<b>const</b> std::basic_string<charT, ST, SA>& s,
|
<b>const</b> std::basic_string<charT, ST, SA>& s,
|
||||||
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
<b>const</b> basic_regex<charT, traits, Allocator>& e,
|
||||||
<b>unsigned</b> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
</pre>
|
</pre>
|
||||||
<p>The parameters for the primary version of regex_grep have the following
|
<p>The parameters for the primary version of regex_grep have the following
|
||||||
meanings: </p>
|
meanings: </p>
|
||||||
@@ -370,11 +370,10 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh
|
|||||||
<hr>
|
<hr>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ void</B> IndexClasses(map_type& m, <B>const</B> std::string& file)
|
|||||||
start = file.begin();
|
start = file.begin();
|
||||||
end = file.end();
|
end = file.end();
|
||||||
boost::<a href="match_results.html">match_results</a><std::string::const_iterator> what;
|
boost::<a href="match_results.html">match_results</a><std::string::const_iterator> what;
|
||||||
<B>unsigned</B> <B>int</B> flags = boost::match_default;
|
boost::match_flag_type flags = boost::match_default;
|
||||||
<B>while</B>(regex_search(start, end, what, expression, flags))
|
<B>while</B>(regex_search(start, end, what, expression, flags))
|
||||||
{
|
{
|
||||||
<FONT color=#000080> <I>// what[0] contains the whole string
|
<FONT color=#000080> <I>// what[0] contains the whole string
|
||||||
@@ -314,11 +314,10 @@ void</B> IndexClasses(map_type& m, <B>const</B> std::string& file)
|
|||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -38,15 +38,15 @@
|
|||||||
<PRE><B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
<PRE><B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||||
<B> unsigned</B> flags,
|
<STRONG> </STRONG>boost::match_flag_type flags,
|
||||||
std::size_t max_split);
|
std::size_t max_split);
|
||||||
|
|
||||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1, <B>class</B> Traits2, <B>class</B> Alloc2>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||||
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
<B> const</B> basic_regex<charT, Traits2, Alloc2>& e,
|
||||||
<B>unsigned</B> flags = match_default);
|
boost::match_flag_type flags = match_default);
|
||||||
|
|
||||||
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1>
|
<B>template</B> <<B>class</B> OutputIterator, <B>class</B> charT, <B>class</B> Traits1, <B>class</B> Alloc1>
|
||||||
std::size_t regex_split(OutputIterator out,
|
std::size_t regex_split(OutputIterator out,
|
||||||
@@ -134,11 +134,10 @@ boost::regex e(<FONT color=#000080>"<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)
|
|||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
04 Feb 2004
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ typedef regex_token_iterator<const char*> cregex_token_i
|
|||||||
typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
|
typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
|
||||||
#ifndef BOOST_NO_WREGEX
|
#ifndef BOOST_NO_WREGEX
|
||||||
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
||||||
typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_iterator;
|
typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_iterator;
|
||||||
#endif
|
#endif
|
||||||
</PRE>
|
</PRE>
|
||||||
<H3><A name="description"></A>Description</H3>
|
<H3><A name="description"></A>Description</H3>
|
||||||
@@ -84,7 +84,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
<P><B> Effects:</B> constructs an end of sequence iterator.</P>
|
<P><B> Effects:</B> constructs an end of sequence iterator.</P>
|
||||||
<PRE><A name=c2></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
<PRE><A name=c2></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
int submatch = 0, match_flag_type m = match_default);</PRE>
|
int submatch = 0, match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>. Object re shall exist
|
||||||
|
for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate one
|
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate one
|
||||||
string for each regular expression match of the expression <EM>re</EM> found
|
string for each regular expression match of the expression <EM>re</EM> found
|
||||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. The
|
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. The
|
||||||
@@ -99,7 +100,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
configured</A> in non-recursive mode).</P>
|
configured</A> in non-recursive mode).</P>
|
||||||
<PRE><A name=c3></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
<PRE><A name=c3></A>regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
const std::vector<int>& submatches, match_flag_type m = match_default);</PRE>
|
const std::vector<int>& submatches, match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions:</B> <CODE>submatches.size() && !re.empty()</CODE>.</P>
|
<P><B> Preconditions:</B> <CODE>submatches.size() && !re.empty()</CODE>.
|
||||||
|
Object re shall exist for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate <EM>submatches.size()</EM>
|
<P><B> Effects:</B> constructs a regex_token_iterator that will enumerate <EM>submatches.size()</EM>
|
||||||
strings for each regular expression match of the expression <EM>re</EM> found
|
strings for each regular expression match of the expression <EM>re</EM> found
|
||||||
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. For
|
within the sequence <EM>[a,b)</EM>, using match flags <EM>m</EM>. For
|
||||||
@@ -118,7 +120,8 @@ typedef regex_token_iterator<<std::wstring::const_iterator> wsregex_token_
|
|||||||
<PRE><A name=c4></A>template <std::size_t N>
|
<PRE><A name=c4></A>template <std::size_t N>
|
||||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
const int (&submatches)[R], match_flag_type m = match_default);</PRE>
|
const int (&submatches)[R], match_flag_type m = match_default);</PRE>
|
||||||
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>.</P>
|
<P><B> Preconditions: </B><CODE>!re.empty()</CODE>. Object re shall exist
|
||||||
|
for the lifetime of the iterator constructed from it.</P>
|
||||||
<P><STRONG>Effects:</STRONG></B> constructs a regex_token_iterator that will
|
<P><STRONG>Effects:</STRONG></B> constructs a regex_token_iterator that will
|
||||||
enumerate <EM>R</EM> strings for each regular expression match of the
|
enumerate <EM>R</EM> strings for each regular expression match of the
|
||||||
expression <EM>re</EM> found within the sequence <EM>[a,b)</EM>, using match
|
expression <EM>re</EM> found within the sequence <EM>[a,b)</EM>, using match
|
||||||
|
|||||||
@@ -24,10 +24,12 @@
|
|||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p></p>
|
<p></p>
|
||||||
<P>Under construction.</P>
|
<P>
|
||||||
<P>The current boost.regex traits class design will be migrated to that specified
|
Under construction: the current design will be replaced by that specified in
|
||||||
in the <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
|
the <A href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
|
||||||
expression standardization proposal</A>. </P>
|
expression standardization proposal</A>, the current (obsolete) design has
|
||||||
|
it's <A href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/boost/boost/libs/regex/Attic/traits_class_ref.htm?rev=1.11">
|
||||||
|
documentation archived online</A>.</P>
|
||||||
<P>
|
<P>
|
||||||
<HR>
|
<HR>
|
||||||
<P></P>
|
<P></P>
|
||||||
@@ -36,11 +38,9 @@
|
|||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
199
doc/syntax.html
199
doc/syntax.html
@@ -91,18 +91,18 @@
|
|||||||
<P>Parentheses serve two purposes, to group items together into a sub-expression,
|
<P>Parentheses serve two purposes, to group items together into a sub-expression,
|
||||||
and to mark what generated the match. For example the expression "(ab)*" would
|
and to mark what generated the match. For example the expression "(ab)*" would
|
||||||
match all of the string "ababab". The matching algorithms <A href="regex_match.html">
|
match all of the string "ababab". The matching algorithms <A href="regex_match.html">
|
||||||
regex_match</A> and <A href="regex_search.html">regex_search</A>
|
regex_match</A> and <A href="regex_search.html">regex_search</A> each take
|
||||||
each take an instance of <A href="match_results.html">match_results</A>
|
an instance of <A href="match_results.html">match_results</A> that reports what
|
||||||
that reports what caused the match, on exit from these functions the <A href="match_results.html">
|
caused the match, on exit from these functions the <A href="match_results.html">match_results</A>
|
||||||
match_results</A> contains information both on what the whole expression
|
contains information both on what the whole expression matched and on what each
|
||||||
matched and on what each sub-expression matched. In the example above
|
sub-expression matched. In the example above match_results[1] would contain a
|
||||||
match_results[1] would contain a pair of iterators denoting the final "ab" of
|
pair of iterators denoting the final "ab" of the matching string. It is
|
||||||
the matching string. It is permissible for sub-expressions to match null
|
permissible for sub-expressions to match null strings. If a sub-expression
|
||||||
strings. If a sub-expression takes no part in a match - for example if it is
|
takes no part in a match - for example if it is part of an alternative that is
|
||||||
part of an alternative that is not taken - then both of the iterators that are
|
not taken - then both of the iterators that are returned for that
|
||||||
returned for that sub-expression point to the end of the input string, and the <I>matched</I>
|
sub-expression point to the end of the input string, and the <I>matched</I> parameter
|
||||||
parameter for that sub-expression is <I>false</I>. Sub-expressions are indexed
|
for that sub-expression is <I>false</I>. Sub-expressions are indexed from left
|
||||||
from left to right starting from 1, sub-expression 0 is the whole expression.
|
to right starting from 1, sub-expression 0 is the whole expression.
|
||||||
</P>
|
</P>
|
||||||
<H3>Non-Marking Parenthesis
|
<H3>Non-Marking Parenthesis
|
||||||
</H3>
|
</H3>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<P>A set is a set of characters that can match any single character that is a
|
<P>A set is a set of characters that can match any single character that is a
|
||||||
member of the set. Sets are delimited by "[" and "]" and can contain literals,
|
member of the set. Sets are delimited by "[" and "]" and can contain literals,
|
||||||
character ranges, character classes, collating elements and equivalence
|
character ranges, character classes, collating elements and equivalence
|
||||||
classes. Set declarations that start with "^" contain the compliment of the
|
classes. Set declarations that start with "^" contain the complement of the
|
||||||
elements that follow.
|
elements that follow.
|
||||||
</P>
|
</P>
|
||||||
<P>Examples:
|
<P>Examples:
|
||||||
@@ -293,7 +293,7 @@
|
|||||||
[^[.ae.]] would only match one character.
|
[^[.ae.]] would only match one character.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
Equivalence classes take the general form[=tagname=] inside a set declaration,
|
Equivalence classes take the generalform[=tagname=] inside a set declaration,
|
||||||
where <I>tagname</I> is either a single character, or a name of a collating
|
where <I>tagname</I> is either a single character, or a name of a collating
|
||||||
element, and matches any character that is a member of the same primary
|
element, and matches any character that is a member of the same primary
|
||||||
equivalence class as the collating element [.tagname.]. An equivalence class is
|
equivalence class as the collating element [.tagname.]. An equivalence class is
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
typically collated by character, then by accent, and then by case; the primary
|
typically collated by character, then by accent, and then by case; the primary
|
||||||
sort key then relates to the character, the secondary to the accentation, and
|
sort key then relates to the character, the secondary to the accentation, and
|
||||||
the tertiary to the case). If there is no equivalence class corresponding to <I>tagname</I>
|
the tertiary to the case). If there is no equivalence class corresponding to <I>tagname</I>
|
||||||
, then[=tagname=] is exactly the same as [.tagname.]. Unfortunately there is no
|
,then[=tagname=] is exactly the same as [.tagname.]. Unfortunately there is no
|
||||||
locale independent method of obtaining the primary sort key for a character,
|
locale independent method of obtaining the primary sort key for a character,
|
||||||
except under Win32. For other operating systems the library will "guess" the
|
except under Win32. For other operating systems the library will "guess" the
|
||||||
primary sort key from the full sort key (obtained from <I>strxfrm</I>), so
|
primary sort key from the full sort key (obtained from <I>strxfrm</I>), so
|
||||||
@@ -666,106 +666,103 @@
|
|||||||
<H3>What gets matched?
|
<H3>What gets matched?
|
||||||
</H3>
|
</H3>
|
||||||
<P>
|
<P>
|
||||||
When the expression is compiled as a Perl-compatible regex then the matching
|
When the expression is compiled as a Perl-compatible regex then the matching
|
||||||
algorithms will perform a depth first search on the state machine and report
|
algorithms will perform a depth first search on the state machine and report
|
||||||
the first match found.</P>
|
the first match found.</P>
|
||||||
<P>
|
<P>
|
||||||
When the expression is compiled as a POSIX-compatible regex then the matching
|
When the expression is compiled as a POSIX-compatible regex then the matching
|
||||||
algorithms will match the first possible matching string, if more than one
|
algorithms will match the first possible matching string, if more than one
|
||||||
string starting at a given location can match then it matches the longest
|
string starting at a given location can match then it matches the longest
|
||||||
possible string, unless the flag match_any is set, in which case the first
|
possible string, unless the flag match_any is set, in which case the first
|
||||||
match encountered is returned. Use of the match_any option can reduce the time
|
match encountered is returned. Use of the match_any option can reduce the time
|
||||||
taken to find the match - but is only useful if the user is less concerned
|
taken to find the match - but is only useful if the user is less concerned
|
||||||
about what matched - for example it would not be suitable for search and
|
about what matched - for example it would not be suitable for search and
|
||||||
replace operations. In cases where their are multiple possible matches all
|
replace operations. In cases where their are multiple possible matches all
|
||||||
starting at the same location, and all of the same length, then the match
|
starting at the same location, and all of the same length, then the match
|
||||||
chosen is the one with the longest first sub-expression, if that is the same
|
chosen is the one with the longest first sub-expression, if that is the same
|
||||||
for two or more matches, then the second sub-expression will be examined and so
|
for two or more matches, then the second sub-expression will be examined and so
|
||||||
on.
|
on.
|
||||||
</P><P>
|
|
||||||
The following table examples illustrate the main differences between Perl and
|
|
||||||
POSIX regular expression matching rules:
|
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
<TABLE id="Table5" cellSpacing="1" cellPadding="7" width="624" border="1">
|
The following table examples illustrate the main differences between Perl and
|
||||||
<TBODY>
|
POSIX regular expression matching rules:
|
||||||
<TR>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>Expression</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>Text</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>POSIX leftmost longest match</P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P>ECMAScript depth first search match</P>
|
|
||||||
</TD>
|
|
||||||
</TR>
|
|
||||||
<TR>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P><CODE>a|ab</CODE></P>
|
|
||||||
</TD>
|
|
||||||
<TD vAlign="top" width="25%">
|
|
||||||
<P><CODE>
|
|
||||||
xaby</CODE>
|
|
||||||
</P>
|
</P>
|
||||||
</TD>
|
<P>
|
||||||
<TD vAlign="top" width="25%">
|
<TABLE id="Table5" cellSpacing="1" cellPadding="7" width="624" border="1">
|
||||||
<P><CODE>
|
<TBODY>
|
||||||
"ab"</CODE></P></TD>
|
<TR>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P>Expression</P>
|
||||||
"a"</CODE></P></TD>
|
</TD>
|
||||||
</TR>
|
<TD vAlign="top" width="25%">
|
||||||
<TR>
|
<P>Text</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P><CODE>
|
<TD vAlign="top" width="25%">
|
||||||
.*([[:alnum:]]+).*</CODE></P></TD>
|
<P>POSIX leftmost longest match</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P><CODE>
|
<TD vAlign="top" width="25%">
|
||||||
" abc def xyz "</CODE></P></TD>
|
<P>ECMAScript depth first search match</P>
|
||||||
<TD vAlign="top" width="25%">
|
</TD>
|
||||||
<P>$0 = " abc def xyz "<BR>
|
</TR>
|
||||||
$1 = "abc"</P>
|
<TR>
|
||||||
</TD>
|
<TD vAlign="top" width="25%">
|
||||||
<TD vAlign="top" width="25%">
|
<P><CODE>a|ab</CODE></P>
|
||||||
<P>$0 = " abc def xyz "<BR>
|
</TD>
|
||||||
$1 = "z"</P>
|
<TD vAlign="top" width="25%">
|
||||||
</TD>
|
<P><CODE> xaby</CODE>
|
||||||
</TR>
|
</P>
|
||||||
<TR>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P><CODE> "ab"</CODE></P>
|
||||||
.*(a|xayy)</CODE></P></TD>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
<TD vAlign="top" width="25%">
|
||||||
<P><CODE>
|
<P><CODE> "a"</CODE></P>
|
||||||
zzxayyzz</CODE></P></TD>
|
</TD>
|
||||||
<TD vAlign="top" width="25%">
|
</TR>
|
||||||
<P><CODE>
|
<TR>
|
||||||
"zzxayy"</CODE></P></TD>
|
<TD vAlign="top" width="25%">
|
||||||
<TD vAlign="top" width="25%">
|
<P><CODE> .*([[:alnum:]]+).*</CODE></P>
|
||||||
<P><CODE>"zzxa"</CODE></P>
|
</TD>
|
||||||
</TD>
|
<TD vAlign="top" width="25%">
|
||||||
</TR>
|
<P><CODE> " abc def xyz "</CODE></P>
|
||||||
</TBODY></CODE></TD></TR></TABLE>
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P>$0 = " abc def xyz "<BR>
|
||||||
|
$1 = "abc"</P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P>$0 = " abc def xyz "<BR>
|
||||||
|
$1 = "z"</P>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
<TR>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> .*(a|xayy)</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> zzxayyzz</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE> "zzxayy"</CODE></P>
|
||||||
|
</TD>
|
||||||
|
<TD vAlign="top" width="25%">
|
||||||
|
<P><CODE>"zzxa"</CODE></P>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</TBODY></CODE></TD></TR></TABLE>
|
||||||
<P>These differences between Perl matching rules, and POSIX matching rules, mean
|
<P>These differences between Perl matching rules, and POSIX matching rules, mean
|
||||||
that these two regular expression syntaxes differ not only in the features
|
that these two regular expression syntaxes differ not only in the features
|
||||||
offered, but also in the form that the state machine takes and/or the
|
offered, but also in the form that the state machine takes and/or the
|
||||||
algorithms used to traverse the state machine.</p>
|
algorithms used to traverse the state machine.</P>
|
||||||
<HR>
|
<HR>
|
||||||
<p>Revised
|
<p>Revised
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||||
24 Oct 2003
|
24 Oct 2003
|
||||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
|
||||||
<p><i><EFBFBD> Copyright John Maddock 1998-
|
<p><i><EFBFBD> Copyright John Maddock 1998-
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan -->
|
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
||||||
2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
|
|
||||||
<P><I>Use, modification and distribution are subject to the Boost Software License,
|
<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>
|
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>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ public:
|
|||||||
std::string What(int i = 0)const;
|
std::string What(int i = 0)const;
|
||||||
std::string operator[](int i)const { return What(i); }
|
std::string operator[](int i)const { return What(i); }
|
||||||
|
|
||||||
static const unsigned int npos;
|
static const std::size_t npos;
|
||||||
|
|
||||||
friend struct re_detail::pred1;
|
friend struct re_detail::pred1;
|
||||||
friend struct re_detail::pred2;
|
friend struct re_detail::pred2;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ typedef enum _match_flags
|
|||||||
|
|
||||||
} match_flags;
|
} match_flags;
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || defined(__SUNPRO_CC)
|
||||||
typedef unsigned long match_flag_type;
|
typedef unsigned long match_flag_type;
|
||||||
#else
|
#else
|
||||||
typedef match_flags match_flag_type;
|
typedef match_flags match_flag_type;
|
||||||
@@ -88,11 +88,11 @@ inline match_flags operator^(match_flags m1, match_flags m2)
|
|||||||
inline match_flags operator~(match_flags m1)
|
inline match_flags operator~(match_flags m1)
|
||||||
{ return static_cast<match_flags>(~static_cast<boost::int32_t>(m1)); }
|
{ return static_cast<match_flags>(~static_cast<boost::int32_t>(m1)); }
|
||||||
inline match_flags& operator&=(match_flags& m1, match_flags m2)
|
inline match_flags& operator&=(match_flags& m1, match_flags m2)
|
||||||
{ m1 = m1&m2; return m1; }
|
{ m1 = static_cast<match_flags>(m1&m2); return m1; }
|
||||||
inline match_flags& operator|=(match_flags& m1, match_flags m2)
|
inline match_flags& operator|=(match_flags& m1, match_flags m2)
|
||||||
{ m1 = m1|m2; return m1; }
|
{ m1 = static_cast<match_flags>(m1|m2); return m1; }
|
||||||
inline match_flags& operator^=(match_flags& m1, match_flags m2)
|
inline match_flags& operator^=(match_flags& m1, match_flags m2)
|
||||||
{ m1 = m1^m2; return m1; }
|
{ m1 = static_cast<match_flags>(m1^m2); return m1; }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ perl_matcher<BidiIterator, Allocator, traits, Allocator2>::perl_matcher(BidiIter
|
|||||||
estimate_max_state_count(static_cast<category*>(0));
|
estimate_max_state_count(static_cast<category*>(0));
|
||||||
if(!(m_match_flags & (match_perl|match_posix)))
|
if(!(m_match_flags & (match_perl|match_posix)))
|
||||||
{
|
{
|
||||||
if(re.flags() & regex_constants::perlex)
|
if((re.flags() & regex_constants::perlex) || (re.flags() & regex_constants::literal))
|
||||||
m_match_flags |= match_perl;
|
m_match_flags |= match_perl;
|
||||||
else
|
else
|
||||||
m_match_flags |= match_posix;
|
m_match_flags |= match_posix;
|
||||||
@@ -82,7 +82,7 @@ void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_sta
|
|||||||
if(dist > (difference_type)(lim / states))
|
if(dist > (difference_type)(lim / states))
|
||||||
max_state_count = lim;
|
max_state_count = lim;
|
||||||
else
|
else
|
||||||
max_state_count = 1000 + states * dist;
|
max_state_count = 100000 + states * dist;
|
||||||
}
|
}
|
||||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||||
void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(void*)
|
void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(void*)
|
||||||
@@ -205,10 +205,10 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_imp()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// start again:
|
// start again:
|
||||||
search_base = position = (*m_presult)[0].second;
|
search_base = position = m_result[0].second;
|
||||||
// If last match was null and match_not_null was not set then increment
|
// If last match was null and match_not_null was not set then increment
|
||||||
// our start position, otherwise we go into an infinite loop:
|
// our start position, otherwise we go into an infinite loop:
|
||||||
if(((m_match_flags & match_not_null) == 0) && (m_presult->length() == 0))
|
if(((m_match_flags & match_not_null) == 0) && (m_result.length() == 0))
|
||||||
{
|
{
|
||||||
if(position == last)
|
if(position == last)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -38,7 +38,13 @@ inline void inplace_destroy(T* p)
|
|||||||
|
|
||||||
struct saved_state
|
struct saved_state
|
||||||
{
|
{
|
||||||
unsigned int id;
|
union{
|
||||||
|
unsigned int id;
|
||||||
|
// these ensure that this struct gets the same alignment as derived structs:
|
||||||
|
void* padding1;
|
||||||
|
std::size_t padding2;
|
||||||
|
std::ptrdiff_t padding3;
|
||||||
|
};
|
||||||
saved_state(unsigned i) : id(i) {}
|
saved_state(unsigned i) : id(i) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -927,8 +933,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_si
|
|||||||
|
|
||||||
const re_repeat* rep = pmp->rep;
|
const re_repeat* rep = pmp->rep;
|
||||||
unsigned count = pmp->count;
|
unsigned count = pmp->count;
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
|
|
||||||
count -= rep->min;
|
count -= rep->min;
|
||||||
|
|
||||||
@@ -977,8 +983,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_
|
|||||||
const re_repeat* rep = pmp->rep;
|
const re_repeat* rep = pmp->rep;
|
||||||
unsigned count = pmp->count;
|
unsigned count = pmp->count;
|
||||||
assert(rep->type == syntax_element_dot_rep);
|
assert(rep->type == syntax_element_dot_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_wild);
|
assert(rep->next.p->type == syntax_element_wild);
|
||||||
|
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
@@ -1005,7 +1011,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_
|
|||||||
{
|
{
|
||||||
// can't repeat any more, remove the pushed state:
|
// can't repeat any more, remove the pushed state:
|
||||||
destroy_single_repeat();
|
destroy_single_repeat();
|
||||||
if(rep->can_be_null & mask_skip)
|
if(0 == (rep->can_be_null & mask_skip))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(count == rep->max)
|
else if(count == rep->max)
|
||||||
@@ -1057,7 +1063,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_
|
|||||||
{
|
{
|
||||||
// can't repeat any more, remove the pushed state:
|
// can't repeat any more, remove the pushed state:
|
||||||
destroy_single_repeat();
|
destroy_single_repeat();
|
||||||
if(rep->can_be_null & mask_skip)
|
if(0 == (rep->can_be_null & mask_skip))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(count == rep->max)
|
else if(count == rep->max)
|
||||||
@@ -1095,8 +1101,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repe
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_char_rep);
|
assert(rep->type == syntax_element_char_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_literal);
|
assert(rep->next.p->type == syntax_element_literal);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
|
|
||||||
@@ -1121,7 +1127,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repe
|
|||||||
{
|
{
|
||||||
// can't repeat any more, remove the pushed state:
|
// can't repeat any more, remove the pushed state:
|
||||||
destroy_single_repeat();
|
destroy_single_repeat();
|
||||||
if(rep->can_be_null & mask_skip)
|
if(0 == (rep->can_be_null & mask_skip))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(count == rep->max)
|
else if(count == rep->max)
|
||||||
@@ -1159,8 +1165,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_short_set_rep);
|
assert(rep->type == syntax_element_short_set_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_set);
|
assert(rep->next.p->type == syntax_element_set);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
|
|
||||||
@@ -1185,7 +1191,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set
|
|||||||
{
|
{
|
||||||
// can't repeat any more, remove the pushed state:
|
// can't repeat any more, remove the pushed state:
|
||||||
destroy_single_repeat();
|
destroy_single_repeat();
|
||||||
if(rep->can_be_null & mask_skip)
|
if(0 == (rep->can_be_null & mask_skip))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(count == rep->max)
|
else if(count == rep->max)
|
||||||
@@ -1223,8 +1229,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_long_set_rep);
|
assert(rep->type == syntax_element_long_set_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_long_set);
|
assert(rep->next.p->type == syntax_element_long_set);
|
||||||
assert(position != last);
|
assert(position != last);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
@@ -1250,7 +1256,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_
|
|||||||
{
|
{
|
||||||
// can't repeat any more, remove the pushed state:
|
// can't repeat any more, remove the pushed state:
|
||||||
destroy_single_repeat();
|
destroy_single_repeat();
|
||||||
if(rep->can_be_null & mask_skip)
|
if(0 == (rep->can_be_null & mask_skip))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(count == rep->max)
|
else if(count == rep->max)
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat
|
|||||||
// start by working out how much we can skip:
|
// start by working out how much we can skip:
|
||||||
//
|
//
|
||||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||||
unsigned count = std::min(static_cast<unsigned>(re_detail::distance(position, last)), (rep->greedy ? rep->max : rep->min));
|
unsigned count = (std::min)(static_cast<unsigned>(re_detail::distance(position, last)), (rep->greedy ? rep->max : rep->min));
|
||||||
if(rep->min > count)
|
if(rep->min > count)
|
||||||
return false; // not enough text left to match
|
return false; // not enough text left to match
|
||||||
std::advance(position, count);
|
std::advance(position, count);
|
||||||
@@ -458,7 +458,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repea
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, (std::min)((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
||||||
{
|
{
|
||||||
@@ -507,8 +507,16 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repea
|
|||||||
return false;
|
return false;
|
||||||
if(position == last)
|
if(position == last)
|
||||||
return false;
|
return false;
|
||||||
position = ++save_pos;
|
position = save_pos;
|
||||||
++count;
|
if(traits_inst.translate(*position, icase) == what)
|
||||||
|
{
|
||||||
|
++position;
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}while(true);
|
}while(true);
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma option pop
|
#pragma option pop
|
||||||
@@ -538,7 +546,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, (std::min)((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
||||||
{
|
{
|
||||||
@@ -587,8 +595,16 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat
|
|||||||
return false;
|
return false;
|
||||||
if(position == last)
|
if(position == last)
|
||||||
return false;
|
return false;
|
||||||
position = ++save_pos;
|
position = save_pos;
|
||||||
++count;
|
if(map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
||||||
|
{
|
||||||
|
++position;
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}while(true);
|
}while(true);
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma option pop
|
#pragma option pop
|
||||||
@@ -618,7 +634,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_r
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, (std::min)((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
||||||
{
|
{
|
||||||
@@ -667,8 +683,16 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_r
|
|||||||
return false;
|
return false;
|
||||||
if(position == last)
|
if(position == last)
|
||||||
return false;
|
return false;
|
||||||
position = ++save_pos;
|
position = save_pos;
|
||||||
++count;
|
if(position != re_is_set_member(position, last, set, re))
|
||||||
|
{
|
||||||
|
++position;
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}while(true);
|
}while(true);
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma option pop
|
#pragma option pop
|
||||||
|
|||||||
@@ -721,6 +721,13 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
|
|||||||
re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
|
re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
|
||||||
re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
|
re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
|
||||||
re_detail::jstack<traits_string_type, Allocator> equivalents(64, data.allocator());
|
re_detail::jstack<traits_string_type, Allocator> equivalents(64, data.allocator());
|
||||||
|
if(_flags & regbase::icase)
|
||||||
|
{
|
||||||
|
if((cls == traits_type::char_class_upper) || (cls == traits_type::char_class_lower))
|
||||||
|
{
|
||||||
|
cls = traits_type::char_class_alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
classes.push(cls);
|
classes.push(cls);
|
||||||
if(dat)
|
if(dat)
|
||||||
{
|
{
|
||||||
@@ -1066,7 +1073,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
|
|||||||
++csingles;
|
++csingles;
|
||||||
const traits_string_type& s = singles.peek();
|
const traits_string_type& s = singles.peek();
|
||||||
std::size_t len = (s.size() + 1) * sizeof(charT);
|
std::size_t len = (s.size() + 1) * sizeof(charT);
|
||||||
if(len > sizeof(charT))
|
if(len > sizeof(charT) * 2)
|
||||||
singleton = false;
|
singleton = false;
|
||||||
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
|
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
|
||||||
singles.pop();
|
singles.pop();
|
||||||
@@ -1350,6 +1357,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
|
|||||||
data.clear();
|
data.clear();
|
||||||
_flags = f;
|
_flags = f;
|
||||||
fail(REG_NOERROR); // clear any error
|
fail(REG_NOERROR); // clear any error
|
||||||
|
_leading_len = 0; // set this to non-zero if there are any backrefs, we'll refer to it later...
|
||||||
|
|
||||||
if(arg_first >= arg_last)
|
if(arg_first >= arg_last)
|
||||||
{
|
{
|
||||||
@@ -1427,7 +1435,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
|
|||||||
{
|
{
|
||||||
case traits_type::syntax_colon:
|
case traits_type::syntax_colon:
|
||||||
static_cast<re_detail::re_brace*>(dat)->index = 0;
|
static_cast<re_detail::re_brace*>(dat)->index = 0;
|
||||||
--marks;
|
if((_flags & nosubs) == 0)
|
||||||
|
--marks;
|
||||||
markid.pop();
|
markid.pop();
|
||||||
markid.push(0);
|
markid.push(0);
|
||||||
++ptr;
|
++ptr;
|
||||||
@@ -1437,7 +1446,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
|
|||||||
markid.pop();
|
markid.pop();
|
||||||
markid.push(-1);
|
markid.push(-1);
|
||||||
common_forward_assert:
|
common_forward_assert:
|
||||||
--marks;
|
if((_flags & nosubs) == 0)
|
||||||
|
--marks;
|
||||||
++ptr;
|
++ptr;
|
||||||
// extend:
|
// extend:
|
||||||
dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
|
dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
|
||||||
@@ -1462,7 +1472,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
|
|||||||
case traits_type::syntax_hash:
|
case traits_type::syntax_hash:
|
||||||
// comment just skip it:
|
// comment just skip it:
|
||||||
static_cast<re_detail::re_brace*>(dat)->index = 0;
|
static_cast<re_detail::re_brace*>(dat)->index = 0;
|
||||||
--marks;
|
if((_flags & nosubs) == 0)
|
||||||
|
--marks;
|
||||||
markid.pop();
|
markid.pop();
|
||||||
mark.pop();
|
mark.pop();
|
||||||
do{
|
do{
|
||||||
@@ -1600,6 +1611,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
|
|||||||
dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace));
|
dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace));
|
||||||
static_cast<re_detail::re_brace*>(dat)->index = i;
|
static_cast<re_detail::re_brace*>(dat)->index = i;
|
||||||
++ptr;
|
++ptr;
|
||||||
|
_leading_len = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2141,7 +2153,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
|
|||||||
case re_detail::syntax_element_char_rep:
|
case re_detail::syntax_element_char_rep:
|
||||||
case re_detail::syntax_element_short_set_rep:
|
case re_detail::syntax_element_short_set_rep:
|
||||||
case re_detail::syntax_element_long_set_rep:
|
case re_detail::syntax_element_long_set_rep:
|
||||||
if((len == 0) && (1 == fixup_leading_rep(dat->next.p, static_cast<re_detail::re_repeat*>(dat)->alt.p) ))
|
if((len == 0) && (_leading_len == 0) && (1 == fixup_leading_rep(dat->next.p, static_cast<re_detail::re_repeat*>(dat)->alt.p) ))
|
||||||
{
|
{
|
||||||
static_cast<re_detail::re_repeat*>(dat)->leading = leading_lit;
|
static_cast<re_detail::re_repeat*>(dat)->leading = leading_lit;
|
||||||
return len;
|
return len;
|
||||||
|
|||||||
@@ -55,23 +55,23 @@ inline unsigned int regex_grep(Predicate foo,
|
|||||||
return count; // we've reached the end, don't try and find an extra null match.
|
return count; // we've reached the end, don't try and find an extra null match.
|
||||||
if(m.length() == 0)
|
if(m.length() == 0)
|
||||||
{
|
{
|
||||||
|
if(m[0].second == last)
|
||||||
|
return count;
|
||||||
// we found a NULL-match, now try to find
|
// we found a NULL-match, now try to find
|
||||||
// a non-NULL one at the same position:
|
// a non-NULL one at the same position:
|
||||||
BidiIterator last_end(m[0].second);
|
match_results<BidiIterator, match_allocator_type> m2(m);
|
||||||
if(last_end == last)
|
|
||||||
return count;
|
|
||||||
matcher.setf(match_not_null | match_continuous);
|
matcher.setf(match_not_null | match_continuous);
|
||||||
if(matcher.find())
|
if(matcher.find())
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
last_end = m[0].second;
|
//last_end = m[0].second;
|
||||||
if(0 == foo(m))
|
if(0 == foo(m))
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// reset match back to where it was:
|
// reset match back to where it was:
|
||||||
m.set_second(last_end);
|
m = m2;
|
||||||
}
|
}
|
||||||
matcher.unsetf((match_not_null | match_continuous) & ~flags);
|
matcher.unsetf((match_not_null | match_continuous) & ~flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ template <class BidirectionalIterator,
|
|||||||
class traits = regex_traits<charT>,
|
class traits = regex_traits<charT>,
|
||||||
class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
||||||
class regex_iterator
|
class regex_iterator
|
||||||
|
#ifndef BOOST_NO_STD_ITERATOR
|
||||||
|
: public std::iterator<
|
||||||
|
std::forward_iterator_tag,
|
||||||
|
match_results<BidirectionalIterator>,
|
||||||
|
typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||||
|
const match_results<BidirectionalIterator>*,
|
||||||
|
const match_results<BidirectionalIterator>& >
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef regex_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
|
typedef regex_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||||
|
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
//
|
//
|
||||||
// Borland C++ Builder 6, and Visual C++ 6,
|
// Borland C++ Builder 6, and Visual C++ 6,
|
||||||
// can't cope with the array template constructor
|
// can't cope with the array template constructor
|
||||||
@@ -51,11 +52,7 @@ template <class BidirectionalIterator,
|
|||||||
class regex_token_iterator_implementation
|
class regex_token_iterator_implementation
|
||||||
{
|
{
|
||||||
typedef basic_regex<charT, traits, Allocator> regex_type;
|
typedef basic_regex<charT, traits, Allocator> regex_type;
|
||||||
#if 1
|
|
||||||
typedef sub_match<BidirectionalIterator> value_type;
|
typedef sub_match<BidirectionalIterator> value_type;
|
||||||
#else
|
|
||||||
typedef std::basic_string<charT> value_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
match_results<BidirectionalIterator> what; // current match
|
match_results<BidirectionalIterator> what; // current match
|
||||||
BidirectionalIterator end; // end of search area
|
BidirectionalIterator end; // end of search area
|
||||||
@@ -69,10 +66,11 @@ public:
|
|||||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
|
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
|
||||||
: end(last), pre(p), flags(f){ subs.push_back(sub); }
|
: end(last), pre(p), flags(f){ subs.push_back(sub); }
|
||||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
||||||
: end(last), pre(p), subs(v), flags(f){}
|
: end(last), pre(p), flags(f), subs(v){}
|
||||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||||
|
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
template <class T>
|
template <class T>
|
||||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
|
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
|
||||||
: end(last), pre(p), flags(f)
|
: end(last), pre(p), flags(f)
|
||||||
@@ -163,6 +161,14 @@ template <class BidirectionalIterator,
|
|||||||
class traits = regex_traits<charT>,
|
class traits = regex_traits<charT>,
|
||||||
class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
||||||
class regex_token_iterator
|
class regex_token_iterator
|
||||||
|
#ifndef BOOST_NO_STD_ITERATOR
|
||||||
|
: public std::iterator<
|
||||||
|
std::forward_iterator_tag,
|
||||||
|
sub_match<BidirectionalIterator>,
|
||||||
|
typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||||
|
const sub_match<BidirectionalIterator>*,
|
||||||
|
const sub_match<BidirectionalIterator>& >
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
|
typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
|
||||||
@@ -193,7 +199,8 @@ public:
|
|||||||
}
|
}
|
||||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||||
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|
||||||
|
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
template <class T>
|
template <class T>
|
||||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||||
const T& submatches, match_flag_type m = match_default)
|
const T& submatches, match_flag_type m = match_default)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
|||||||
typedef typename re_detail::regex_iterator_traits<BidiIterator>::difference_type difference_type;
|
typedef typename re_detail::regex_iterator_traits<BidiIterator>::difference_type difference_type;
|
||||||
#endif
|
#endif
|
||||||
typedef BidiIterator iterator_type;
|
typedef BidiIterator iterator_type;
|
||||||
|
typedef BidiIterator iterator;
|
||||||
|
typedef BidiIterator const_iterator;
|
||||||
|
|
||||||
bool matched;
|
bool matched;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ nl_catd message_cat = (nl_catd)-1;
|
|||||||
unsigned int message_count = 0;
|
unsigned int message_count = 0;
|
||||||
std::string* mess_locale;
|
std::string* mess_locale;
|
||||||
|
|
||||||
BOOST_REGEX_DECL char* re_custom_error_messages[] = {
|
char* re_custom_error_messages[] = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -182,8 +182,8 @@ std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, std::si
|
|||||||
|
|
||||||
#ifndef BOOST_NO_WREGEX
|
#ifndef BOOST_NO_WREGEX
|
||||||
|
|
||||||
BOOST_REGEX_DECL boost::regex_wchar_type re_zero_w;
|
boost::regex_wchar_type re_zero_w;
|
||||||
BOOST_REGEX_DECL boost::regex_wchar_type re_ten_w;
|
boost::regex_wchar_type re_ten_w;
|
||||||
|
|
||||||
unsigned int nlsw_count = 0;
|
unsigned int nlsw_count = 0;
|
||||||
std::string* wlocale_name = 0;
|
std::string* wlocale_name = 0;
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(char c)const
|
|||||||
|
|
||||||
int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
|
int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
|
||||||
{
|
{
|
||||||
pmd->sbuf.pubsetbuf(const_cast<char*>(first), static_cast<std::streamsize>(last-first));
|
pmd->sbuf.pubsetbuf(const_cast<char*>(static_cast<const char*>(first)), static_cast<std::streamsize>(last-first));
|
||||||
pmd->is.clear();
|
pmd->is.clear();
|
||||||
if(std::abs(radix) == 16) pmd->is >> std::hex;
|
if(std::abs(radix) == 16) pmd->is >> std::hex;
|
||||||
else if(std::abs(radix) == 8) pmd->is >> std::oct;
|
else if(std::abs(radix) == 8) pmd->is >> std::oct;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <boost/cregex.hpp>
|
#include <boost/cregex.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
#include <boost/integer_traits.hpp>
|
||||||
#if !defined(BOOST_NO_STD_STRING)
|
#if !defined(BOOST_NO_STD_STRING)
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -113,7 +114,7 @@ void RegExData::update()
|
|||||||
for(unsigned int i = 0; i < m.size(); ++i)
|
for(unsigned int i = 0; i < m.size(); ++i)
|
||||||
{
|
{
|
||||||
if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second);
|
if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second);
|
||||||
positions[i] = m[i].matched ? m[i].first - pbase : -1;
|
positions[i] = m[i].matched ? m[i].first - pbase : RegEx::npos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
#ifndef BOOST_REGEX_NO_FILEITER
|
||||||
@@ -122,7 +123,7 @@ void RegExData::update()
|
|||||||
for(unsigned int i = 0; i < fm.size(); ++i)
|
for(unsigned int i = 0; i < fm.size(); ++i)
|
||||||
{
|
{
|
||||||
if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second);
|
if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second);
|
||||||
positions[i] = fm[i].matched ? fm[i].first - fbase : -1;
|
positions[i] = fm[i].matched ? fm[i].first - fbase : RegEx::npos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -585,7 +586,13 @@ std::string RegEx::What(int i)const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int RegEx::npos = ~0u;
|
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||||
|
const std::size_t RegEx::npos = ::boost::integer_traits<std::size_t>::const_max;
|
||||||
|
#elif defined(BOOST_HAS_LONG_LONG)
|
||||||
|
const std::size_t RegEx::npos = ~0ULL;
|
||||||
|
#else
|
||||||
|
const std::size_t RegEx::npos = ~0UL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ std::list<collate_name_t>* pcoll_names = 0;
|
|||||||
|
|
||||||
HINSTANCE hresmod = 0;
|
HINSTANCE hresmod = 0;
|
||||||
|
|
||||||
BOOST_REGEX_DECL char* re_custom_error_messages[] = {
|
char* re_custom_error_messages[] = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -147,8 +147,8 @@ enum syntax_map_size
|
|||||||
|
|
||||||
#ifndef BOOST_NO_WREGEX
|
#ifndef BOOST_NO_WREGEX
|
||||||
|
|
||||||
BOOST_REGEX_DECL boost::regex_wchar_type re_zero_w;
|
boost::regex_wchar_type re_zero_w;
|
||||||
BOOST_REGEX_DECL boost::regex_wchar_type re_ten_w;
|
boost::regex_wchar_type re_ten_w;
|
||||||
|
|
||||||
bool isPlatformNT = false;
|
bool isPlatformNT = false;
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
|
|||||||
(m[-2].first - x) << "," << (m[-2].second - x) << ") expected (" <<
|
(m[-2].first - x) << "," << (m[-2].second - x) << ") expected (" <<
|
||||||
matches[1] << "," << (y-x) << ")" << endl;
|
matches[1] << "," << (y-x) << ")" << endl;
|
||||||
}
|
}
|
||||||
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)) && !defined(BOOST_REGEX_V3)
|
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)) && !defined(BOOST_REGEX_V3) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
|
||||||
//
|
//
|
||||||
// now try comparison operators:
|
// now try comparison operators:
|
||||||
string_type s(m[0]);
|
string_type s(m[0]);
|
||||||
@@ -593,7 +593,7 @@ hl_grep_test_proc(const RegEx& e)
|
|||||||
// check $`:
|
// check $`:
|
||||||
start = e.Position(-1);
|
start = e.Position(-1);
|
||||||
end = start + e.Length(-1);
|
end = start + e.Length(-1);
|
||||||
if(start == -1)
|
if(start == boost::RegEx::npos)
|
||||||
{
|
{
|
||||||
if(hl_match_id &&
|
if(hl_match_id &&
|
||||||
( matches[hl_match_id] != matches[hl_match_id - 1] )
|
( matches[hl_match_id] != matches[hl_match_id - 1] )
|
||||||
@@ -628,7 +628,7 @@ hl_grep_test_proc(const RegEx& e)
|
|||||||
// check $':
|
// check $':
|
||||||
start = e.Position(-2);
|
start = e.Position(-2);
|
||||||
end = start + e.Length(-2);
|
end = start + e.Length(-2);
|
||||||
if(start == -1)
|
if(start == boost::RegEx::npos)
|
||||||
{
|
{
|
||||||
if(matches[hl_match_id + 1] != (int)search_text.size())
|
if(matches[hl_match_id + 1] != (int)search_text.size())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -877,6 +877,10 @@ a+(b+) "...aaabb,,,ab*abbb?" $1 "...bb,,,ab*abbb?"
|
|||||||
- match_default normal REG_EXTENDED REG_PERL
|
- match_default normal REG_EXTENDED REG_PERL
|
||||||
a** !
|
a** !
|
||||||
a*? aa 0 0
|
a*? aa 0 0
|
||||||
|
^a*?$ aa 0 2
|
||||||
|
^.*?$ aa 0 2
|
||||||
|
^(?:a)*?$ aa 0 2
|
||||||
|
^[ab]*?$ aa 0 2
|
||||||
a?? aa 0 0
|
a?? aa 0 0
|
||||||
a++ !
|
a++ !
|
||||||
a+? aa 0 1
|
a+? aa 0 1
|
||||||
@@ -1014,6 +1018,7 @@ ab.{2,5}? ab__ 0 4
|
|||||||
ab.{2,5}? ab_______ 0 4
|
ab.{2,5}? ab_______ 0 4
|
||||||
ab.{2,5}?xy ab______xy -1 -1
|
ab.{2,5}?xy ab______xy -1 -1
|
||||||
ab.{2,5}xy ab_xy -1 -1
|
ab.{2,5}xy ab_xy -1 -1
|
||||||
|
(.*?).somesite \n\n555.somesite 2 14 2 5
|
||||||
|
|
||||||
; now again for single character repeats:
|
; now again for single character repeats:
|
||||||
|
|
||||||
@@ -1050,6 +1055,7 @@ ab_{2,5}? ab__ 0 4
|
|||||||
ab_{2,5}? ab_______ 0 4
|
ab_{2,5}? ab_______ 0 4
|
||||||
ab_{2,5}?xy ab______xy -1 -1
|
ab_{2,5}?xy ab______xy -1 -1
|
||||||
ab_{2,5}xy ab_xy -1 -1
|
ab_{2,5}xy ab_xy -1 -1
|
||||||
|
(5*?).somesite //555.somesite 2 14 2 5
|
||||||
|
|
||||||
; and again for sets:
|
; and again for sets:
|
||||||
ab[_,;]*xy abxy_ 0 4
|
ab[_,;]*xy abxy_ 0 4
|
||||||
@@ -1085,6 +1091,7 @@ ab[_,;]{2,5}? ab__ 0 4
|
|||||||
ab[_,;]{2,5}? ab_______ 0 4
|
ab[_,;]{2,5}? ab_______ 0 4
|
||||||
ab[_,;]{2,5}?xy ab______xy -1 -1
|
ab[_,;]{2,5}?xy ab______xy -1 -1
|
||||||
ab[_,;]{2,5}xy ab_xy -1 -1
|
ab[_,;]{2,5}xy ab_xy -1 -1
|
||||||
|
(\d*?).somesite //555.somesite 2 14 2 5
|
||||||
|
|
||||||
; and again for tricky sets with digraphs:
|
; and again for tricky sets with digraphs:
|
||||||
ab[_[.ae.]]*xy abxy_ 0 4
|
ab[_[.ae.]]*xy abxy_ 0 4
|
||||||
@@ -1120,6 +1127,7 @@ ab[_[.ae.]]{2,5}? ab__ 0 4
|
|||||||
ab[_[.ae.]]{2,5}? ab_______ 0 4
|
ab[_[.ae.]]{2,5}? ab_______ 0 4
|
||||||
ab[_[.ae.]]{2,5}?xy ab______xy -1 -1
|
ab[_[.ae.]]{2,5}?xy ab______xy -1 -1
|
||||||
ab[_[.ae.]]{2,5}xy ab_xy -1 -1
|
ab[_[.ae.]]{2,5}xy ab_xy -1 -1
|
||||||
|
([5[.ae.]]*?).somesite //555.somesite 2 14 2 5
|
||||||
|
|
||||||
; new bugs detected in spring 2003:
|
; new bugs detected in spring 2003:
|
||||||
- normal match_continuous REG_NO_POSIX_TEST
|
- normal match_continuous REG_NO_POSIX_TEST
|
||||||
|
|||||||
Reference in New Issue
Block a user