1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Boost.Regex: class RegEx (deprecated)</title>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<body>
<p></p>
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
</td>
<td width="353">
<h1 align="center">Boost.Regex</h1>
<h2 align="center">class RegEx (deprecated)</h2>
</td>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
</td>
</tr>
</table>
<br>
<br>
<hr>
<p>The high level wrapper class RegEx is now deprecated and does not form a part
of the <a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1429.htm">regular
expression standardization proposal</a>. This type still exists, and
existing code will continue to compile, however the following documentation is
unlikely to be further updated.</p>
<pre>
#include <boost/cregex.hpp>
</pre>
<p>The class RegEx provides a high level simplified interface to the regular
expression library, this class only handles narrow character strings, and
regular expressions always follow the "normal" syntax - that is the same as the
perl / ECMAScript synatx.</p>
<pre>
<b>typedef</b> <b>bool</b> (*GrepCallback)(<b>const</b> RegEx& expression);
<b>typedef</b> <b>bool</b> (*GrepFileCallback)(<b>const</b> <b>char</b>* file, <b>const</b> RegEx& expression);
<b>typedef</b> <b>bool</b> (*FindFilesCallback)(<b>const</b> <b>char</b>* file);
<b>class</b> RegEx
{
<b>public</b>:
RegEx();
RegEx(<b>const</b> RegEx& o);
~RegEx();
RegEx(<b>const</b> <b>char</b>* c, <b>bool</b> icase = <b>false</b>);
<strong>explicit</strong> RegEx(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
RegEx& <b>operator</b>=(<b>const</b> RegEx& o);
RegEx& <b>operator</b>=(<b>const</b> <b>char</b>* p);
RegEx& <b>operator</b>=(<b>const</b> std::string& s);
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> <b>char</b>* p, <b>bool</b> icase = <b>false</b>);
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
std::string Expression()<b>const</b>;
<font color="#000080"><i>//
</i> <i>// now matching operators:</i>
<i>//</i></font>
<b>bool</b> Match(<b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);
<b>bool</b> Match(<b>const</b> std::string& s, boost::match_flag_type flags = match_default);
<b>bool</b> Search(<b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);
<b>bool</b> Search(<b>const</b> std::string& s, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> std::string& s, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> std::string& s, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> std::string& s, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, boost::match_flag_type flags = match_default);
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, boost::match_flag_type flags = match_default);
std::string Merge(<b>const</b> std::string& in, <b>const</b> std::string& fmt, <b>bool</b> copy = <b>true</b>, boost::match_flag_type flags = match_default);
std::string Merge(<b>const</b> char* in, <b>const</b> char* fmt, <b>bool</b> copy = <b>true</b>, boost::match_flag_type flags = match_default);
<b>unsigned</b> Split(std::vector<std::string>& v, std::string& s, boost::match_flag_type flags = match_default, <b>unsigned</b> max_count = ~0);
<font color="#000080"><i>//
</i> <i>// now operators for returning what matched in more detail:
</i> <i>//
</i></font> <b>unsigned</b> <b>int</b> Position(<b>int</b> i = 0)<b>const</b>;
<b>unsigned</b> <b>int</b> Length(<b>int</b> i = 0)<b>const</b>;
<strong>bool</strong> Matched(<strong>int</strong> i = 0)<strong>const</strong>;
<b>unsigned</b> <b>int</b> Line()<b>const</b>;
<b>unsigned int</b> Marks() const;
std::string What(<b>int</b> i)<b>const</b>;
std::string <b>operator</b>[](<b>int</b> i)<b>const</b> ;
<strong>static const unsigned int</strong> npos;
};
</pre>
<p>Member functions for class RegEx are defined as follows:<br>
</p>
<p></p>
<table id="Table2" cellspacing="0" cellpadding="7" width="100%" border="0">
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx();</td>
<td valign="top" width="42%">Default constructor, constructs an instance of RegEx
without any valid expression.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx(<b>const</b> RegEx& o);</td>
<td valign="top" width="42%">Copy constructor, all the properties of parameter <i>o</i>
are copied.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx(<b>const</b> <b>char</b>* c, <b>bool</b> icase
= <b>false</b>);</td>
<td valign="top" width="42%">Constructs an instance of RegEx, setting the
expression to <i>c</i>, if <i>icase</i> is <i>true</i> then matching is
insensitive to case, otherwise it is sensitive to case. Throws <i>bad_expression</i>
on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx(<b>const</b> std::string& s, <b>bool</b> icase
= <b>false</b>);</td>
<td valign="top" width="42%">Constructs an instance of RegEx, setting the
expression to <i>s</i>, if <i>icase</i> is <i>true</i> then matching is
insensitive to case, otherwise it is sensitive to case. Throws <i>bad_expression</i>
on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b> RegEx&
o);</td>
<td valign="top" width="42%">Default assignment operator.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b> <b>char</b>*
p);</td>
<td valign="top" width="42%">Assignment operator, equivalent to calling <i>SetExpression(p,
false).</i> Throws <i>bad_expression</i> on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b> std::string&
s);</td>
<td valign="top" width="42%">Assignment operator, equivalent to calling <i>SetExpression(s,
false).</i> Throws <i>bad_expression</i> on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> SetExpression(<b>constchar</b>*
p, <b>bool</b> icase = <b>false</b>);</td>
<td valign="top" width="42%">Sets the current expression to <i>p</i>, if <i>icase</i>
is <i>true</i> then matching is insensitive to case, otherwise it is sensitive
to case. Throws <i>bad_expression</i> on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> SetExpression(<b>const</b>
std::string& s, <b>bool</b> icase = <b>false</b>);</td>
<td valign="top" width="42%">Sets the current expression to <i>s</i>, if <i>icase</i>
is <i>true</i> then matching is insensitive to case, otherwise it is sensitive
to case. Throws <i>bad_expression</i> on failure.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">std::string Expression()<b>const</b>;</td>
<td valign="top" width="42%">Returns a copy of the current regular expression.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b> <b>char</b>* p,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Attempts to match the current expression against the
text <i>p</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. Returns <i>true</i> if the expression matches the whole of
the input string.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b> std::string& s,
boost::match_flag_type flags = match_default) ;</td>
<td valign="top" width="42%">Attempts to match the current expression against the
text <i>s</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. Returns <i>true</i> if the expression matches the whole of
the input string.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b> <b>char</b>* p,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Attempts to find a match for the current expression
somewhere in the text <i>p</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. Returns <i>true</i> if the match succeeds.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b> std::string& s,
boost::match_flag_type flags = match_default) ;</td>
<td valign="top" width="42%">Attempts to find a match for the current expression
somewhere in the text <i>s</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. Returns <i>true</i> if the match succeeds.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b>
<b>char</b>* p, boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>p</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match found calls the call-back function <i>cb</i>
as: cb(*this);
<p>If at any stage the call-back function returns false then the grep operation
terminates, otherwise continues until no further matches are found. Returns the
number of matches found.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b>
std::string& s, boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>s</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match found calls the call-back function <i>cb</i>
as: cb(*this);
<p>If at any stage the call-back function returns false then the grep operation
terminates, otherwise continues until no further matches are found. Returns the
number of matches found.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(std::vector<std::string>&
v, <b>const</b> <b>char</b>* p, boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>p</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match pushes a copy of what matched onto <i>v</i>.
Returns the number of matches found.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(std::vector<std::string>&
v, <b>const</b> std::string& s, boost::match_flag_type flags =
match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>s</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match pushes a copy of what matched onto <i>v</i>.
Returns the number of matches found.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned
int</b>>& v, <b>const</b> <b>char</b>* p, boost::match_flag_type
flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>p</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match pushes the starting index of what matched
onto <i>v</i>. Returns the number of matches found.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned
int</b>>& v, <b>const</b> std::string& s, boost::match_flag_type
flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
text <i>s</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match pushes the starting index of what matched
onto <i>v</i>. Returns the number of matches found.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback
cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
files <i>files</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match calls the call-back function cb.
<p>If the call-back returns false then the algorithm returns without considering
further matches in the current file, or any further files. </p>
<p>The parameter <i>files</i> can include wild card characters '*' and '?', if the
parameter <i>recurse</i> is true then searches sub-directories for matching
file names. </p>
<p>Returns the total number of matches found.</p>
<p>May throw an exception derived from std::runtime_error if file io fails.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback
cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Finds all matches of the current expression in the
files <i>files</i> using the match flags <i>flags</i> - see <a href="match_flag_type.html">
match flags</a>. For each match calls the call-back function cb.
<p>If the call-back returns false then the algorithm returns without considering
further matches in the current file, or any further files. </p>
<p>The parameter <i>files</i> can include wild card characters '*' and '?', if the
parameter <i>recurse</i> is true then searches sub-directories for matching
file names. </p>
<p>Returns the total number of matches found.</p>
<p>May throw an exception derived from std::runtime_error if file io fails.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback
cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Searches <i>files</i> to find all those which contain
at least one match of the current expression using the match flags <i>flags</i>
- see <a href="match_flag_type.html">match flags</a>. For each matching file
calls the call-back function cb.
<p>If the call-back returns false then the algorithm returns without considering
any further files. </p>
<p>The parameter <i>files</i> can include wild card characters '*' and '?', if the
parameter <i>recurse</i> is true then searches sub-directories for matching
file names. </p>
<p>Returns the total number of files found.</p>
<p>May throw an exception derived from std::runtime_error if file io fails.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback
cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>,
boost::match_flag_type flags = match_default);</td>
<td valign="top" width="42%">Searches <i>files</i> to find all those which contain
at least one match of the current expression using the match flags <i>flags</i>
- see <a href="match_flag_type.html">match flags</a>. For each matching file
calls the call-back function cb.
<p>If the call-back returns false then the algorithm returns without considering
any further files. </p>
<p>The parameter <i>files</i> can include wild card characters '*' and '?', if the
parameter <i>recurse</i> is true then searches sub-directories for matching
file names. </p>
<p>Returns the total number of files found.</p>
<p>May throw an exception derived from std::runtime_error if file io fails.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">std::string Merge(<b>const</b> std::string& in, <b>const</b>
std::string& fmt, <b>bool</b> copy = <b>true</b>, boost::match_flag_type
flags = match_default);</td>
<td valign="top" width="42%">Performs a search and replace operation: searches
through the string <i>in</i> for all occurrences of the current expression, for
each occurrence replaces the match with the format string <i>fmt</i>. Uses <i>flags</i>
to determine what gets matched, and how the format string should be treated. If <i>
copy</i> is true then all unmatched sections of input are copied unchanged
to output, if the flag <em>format_first_only</em> is set then only the first
occurance of the pattern found is replaced. Returns the new string. See <a href="format_syntax.html">
also format string syntax</a>, <a href="match_flag_type.html">match flags</a>
and <a href="match_flag_type.html">format flags</a>.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">std::string Merge(<b>const</b> char* in, <b>const</b>
char* fmt, <b>bool</b> copy = <b>true</b>, boost::match_flag_type flags =
match_default);</td>
<td valign="top" width="42%">Performs a search and replace operation: searches
through the string <i>in</i> for all occurrences of the current expression, for
each occurrence replaces the match with the format string <i>fmt</i>. Uses <i>flags</i>
to determine what gets matched, and how the format string should be treated. If <i>
copy</i> is true then all unmatched sections of input are copied unchanged
to output, if the flag <em>format_first_only</em> is set then only the first
occurance of the pattern found is replaced. Returns the new string. See <a href="format_syntax.html">
also format string syntax</a>, <a href="match_flag_type.html">match flags</a>
and <a href="match_flag_type.html">format flags</a>.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td> </td>
<td valign="top"><b>unsigned</b> Split(std::vector<std::string>& v,
std::string& s, boost::match_flag_type flags = match_default, <b>unsigned</b>
max_count = ~0);</td>
<td valign="top">Splits the input string and pushes each one onto the vector. If
the expression contains no marked sub-expressions, then one string is outputted
for each section of the input that does not match the expression. If the
expression does contain marked sub-expressions, then outputs one string for
each marked sub-expression each time a match occurs. Outputs no more than <i>max_count</i>
strings. Before returning, deletes from the input string <i>s</i> all of the
input that has been processed (all of the string if <i>max_count</i> was not
reached). Returns the number of strings pushed onto the vector.</td>
<td> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Position(<b>int</b> i = 0)<b>const</b>;</td>
<td valign="top" width="42%">Returns the position of what matched sub-expression <i>i</i>.
If <i>i = 0</i> then returns the position of the whole match. Returns
RegEx::npos if the supplied index is invalid, or if the specified
sub-expression did not participate in the match.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Length(<b>int</b> i = 0)<b>const</b>;</td>
<td valign="top" width="42%">Returns the length of what matched sub-expression <i>i</i>.
If <i>i = 0</i> then returns the length of the whole match. Returns RegEx::npos
if the supplied index is invalid, or if the specified sub-expression did not
participate in the match.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td> </td>
<td><strong>bool</strong> Matched(<strong>int</strong> i = 0)<strong>const</strong>;</td>
<td>Returns true if sub-expression <em>i</em> was matched, false otherwise.</td>
<td> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned</b> <b>int</b> Line()<b>const</b>;</td>
<td valign="top" width="42%">Returns the line on which the match occurred, indexes
start from 1 not zero, if no match occurred then returns RegEx::npos.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%"><b>unsigned int</b> Marks() const;</td>
<td valign="top" width="42%">Returns the number of marked sub-expressions
contained in the expression. Note that this includes the whole match
(sub-expression zero), so the value returned is always >= 1.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">std::string What(<b>int</b> i)<b>const</b>;</td>
<td valign="top" width="42%">Returns a copy of what matched sub-expression <i>i</i>.
If <i>i = 0</i> then returns a copy of the whole match. Returns a null string
if the index is invalid or if the specified sub-expression did not participate
in a match.</td>
<td valign="top" width="7%"> </td>
</tr>
<tr>
<td valign="top" width="7%"> </td>
<td valign="top" width="43%">std::string <b>operator</b>[](<b>int</b> i)<b>const</b>
;</td>
<td valign="top" width="42%">Returns <i>what(i);</i>
<p>Can be used to simplify access to sub-expression matches, and make usage more
perl-like.</p>
</td>
<td valign="top" width="7%"> </td>
</tr>
</table>
<br>
<br>
<p></p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
04 Feb 2004
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i> Copyright John Maddock 1998-
<!--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,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>
|