Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/regex/doc/regex.html @ 45

Last change on this file since 45 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

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