1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>High Level Class RegEx (Deprecated)</title> 5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../index.html" title="Boost.Regex 5.1.4"> 8<link rel="up" href="../deprecated.html" title="Deprecated Interfaces"> 9<link rel="prev" href="regex_split.html" title="regex_split (deprecated)"> 10<link rel="next" href="../internals.html" title="Internal Details"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="regex_split.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../internals.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="boost_regex.ref.deprecated.old_regex"></a><a class="link" href="old_regex.html" title="High Level Class RegEx (Deprecated)">High Level Class 28 RegEx (Deprecated)</a> 29</h4></div></div></div> 30<p> 31 The high level wrapper class RegEx is now deprecated and does not form 32 part of the regular expression standardization proposal. This type still 33 exists, and existing code will continue to compile, however the following 34 documentation is unlikely to be further updated. 35 </p> 36<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cregex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 37</pre> 38<p> 39 The class RegEx provides a high level simplified interface to the regular 40 expression library, this class only handles narrow character strings, and 41 regular expressions always follow the "normal" syntax - that 42 is the same as the perl / ECMAScript syntax. 43 </p> 44<pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">GrepCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">expression</span><span class="special">);</span> 45<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">GrepFileCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">file</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">expression</span><span class="special">);</span> 46<span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">FindFilesCallback</span><span class="special">)(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">file</span><span class="special">);</span> 47 48<span class="keyword">class</span> <span class="identifier">RegEx</span> 49<span class="special">{</span> 50<span class="keyword">public</span><span class="special">:</span> 51 <span class="identifier">RegEx</span><span class="special">();</span> 52 <span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span> 53 <span class="special">~</span><span class="identifier">RegEx</span><span class="special">();</span> 54 <span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">c</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span> 55 <span class="keyword">explicit</span> <span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span> 56 <span class="identifier">RegEx</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span> 57 <span class="identifier">RegEx</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span> 58 <span class="identifier">RegEx</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">);</span> 59 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">SetExpression</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span> 60 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">SetExpression</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">icase</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">);</span> 61 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Expression</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 62 <span class="comment">//</span> 63 <span class="comment">// now matching operators: </span> 64 <span class="comment">// </span> 65 <span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 66 <span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 67 <span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 68 <span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 69 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> 70 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 71 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> 72 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 73 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> 74 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 75 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> 76 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 77 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> 78 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 79 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> 80 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 81 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">files</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 82 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 83 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">files</span><span class="special">,</span> 84 <span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 85 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 86 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">files</span><span class="special">,</span> 87 <span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 88 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 89 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">files</span><span class="special">,</span> 90 <span class="keyword">bool</span> <span class="identifier">recurse</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 91 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 92 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">in</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span> 93 <span class="keyword">bool</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 94 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">in</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">copy</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> 95 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span> 96 <span class="keyword">unsigned</span> <span class="identifier">Split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> 97 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">match_default</span><span class="special">,</span> 98 <span class="keyword">unsigned</span> <span class="identifier">max_count</span> <span class="special">=</span> <span class="special">~</span><span class="number">0</span><span class="special">);</span> 99 <span class="comment">// </span> 100 <span class="comment">// now operators for returning what matched in more detail: </span> 101 <span class="comment">// </span> 102 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Position</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 103 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 104 <span class="keyword">bool</span> <span class="identifier">Matched</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 105 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Line</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 106 <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">Marks</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 107 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">What</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 108 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span> <span class="special">;</span> 109 110 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">npos</span><span class="special">;</span> 111<span class="special">};</span> 112</pre> 113<p> 114 Member functions for class RegEx are defined as follows: 115 </p> 116<div class="informaltable"><table class="table"> 117<colgroup> 118<col> 119<col> 120</colgroup> 121<thead><tr> 122<th> 123 <p> 124 Member 125 </p> 126 </th> 127<th> 128 <p> 129 Description 130 </p> 131 </th> 132</tr></thead> 133<tbody> 134<tr> 135<td> 136 <p> 137 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">();</span></code> 138 </p> 139 </td> 140<td> 141 <p> 142 Default constructor, constructs an instance of RegEx without 143 any valid expression. 144 </p> 145 </td> 146</tr> 147<tr> 148<td> 149 <p> 150 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span></code> 151 </p> 152 </td> 153<td> 154 <p> 155 Copy constructor, all the properties of parameter <span class="emphasis"><em>o</em></span> 156 are copied. 157 </p> 158 </td> 159</tr> 160<tr> 161<td> 162 <p> 163 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">c</span><span class="special">,</span> <span class="keyword">bool</span> 164 <span class="identifier">icase</span> <span class="special">=</span> 165 <span class="keyword">false</span><span class="special">);</span></code> 166 </p> 167 </td> 168<td> 169 <p> 170 Constructs an instance of RegEx, setting the expression to <span class="emphasis"><em>c</em></span>, 171 if <span class="emphasis"><em>icase</em></span> is true then matching is insensitive 172 to case, otherwise it is sensitive to case. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 173 </p> 174 </td> 175</tr> 176<tr> 177<td> 178 <p> 179 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">bool</span> 180 <span class="identifier">icase</span> <span class="special">=</span> 181 <span class="keyword">false</span><span class="special">);</span></code> 182 </p> 183 </td> 184<td> 185 <p> 186 Constructs an instance of RegEx, setting the expression to <span class="emphasis"><em>s</em></span>, 187 if <span class="emphasis"><em>icase</em></span> is true then matching is insensitive 188 to case, otherwise it is sensitive to case. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 189 </p> 190 </td> 191</tr> 192<tr> 193<td> 194 <p> 195 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</span> 196 <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">RegEx</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span></code> 197 </p> 198 </td> 199<td> 200 <p> 201 Default assignment operator. 202 </p> 203 </td> 204</tr> 205<tr> 206<td> 207 <p> 208 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</span> 209 <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">);</span></code> 210 </p> 211 </td> 212<td> 213 <p> 214 Assignment operator, equivalent to calling <code class="computeroutput"><span class="identifier">SetExpression</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="keyword">false</span><span class="special">)</span></code>. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 215 </p> 216 </td> 217</tr> 218<tr> 219<td> 220 <p> 221 <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">&</span> 222 <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">);</span></code> 223 </p> 224 </td> 225<td> 226 <p> 227 Assignment operator, equivalent to calling <code class="computeroutput"><span class="identifier">SetExpression</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="keyword">false</span><span class="special">)</span></code>. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 228 </p> 229 </td> 230</tr> 231<tr> 232<td> 233 <p> 234 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 235 <span class="identifier">SetExpression</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">bool</span> 236 <span class="identifier">icase</span> <span class="special">=</span> 237 <span class="keyword">false</span><span class="special">);</span></code> 238 </p> 239 </td> 240<td> 241 <p> 242 Sets the current expression to <span class="emphasis"><em>p</em></span>, if <span class="emphasis"><em>icase</em></span> 243 is true then matching is insensitive to case, otherwise it is 244 sensitive to case. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 245 </p> 246 </td> 247</tr> 248<tr> 249<td> 250 <p> 251 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 252 <span class="identifier">SetExpression</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">bool</span> 253 <span class="identifier">icase</span> <span class="special">=</span> 254 <span class="keyword">false</span><span class="special">);</span></code> 255 </p> 256 </td> 257<td> 258 <p> 259 Sets the current expression to <span class="emphasis"><em>s</em></span>, if <span class="emphasis"><em>icase</em></span> 260 is true then matching is insensitive to case, otherwise it is 261 sensitive to case. Throws <a class="link" href="../bad_expression.html" title="bad_expression"><code class="computeroutput"><span class="identifier">bad_expression</span></code></a> on failure. 262 </p> 263 </td> 264</tr> 265<tr> 266<td> 267 <p> 268 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Expression</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span></code> 269 </p> 270 </td> 271<td> 272 <p> 273 Returns a copy of the current regular expression. 274 </p> 275 </td> 276</tr> 277<tr> 278<td> 279 <p> 280 <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span> 281 <span class="keyword">char</span><span class="special">*</span> 282 <span class="identifier">p</span><span class="special">,</span> 283 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 284 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 285 </p> 286 </td> 287<td> 288 <p> 289 Attempts to match the current expression against the text <span class="emphasis"><em>p</em></span> 290 using the match flags <span class="emphasis"><em>flags</em></span> - see <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>. 291 Returns <span class="emphasis"><em>true</em></span> if the expression matches the 292 whole of the input string. 293 </p> 294 </td> 295</tr> 296<tr> 297<td> 298 <p> 299 <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Match</span><span class="special">(</span><span class="keyword">const</span> 300 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 301 <span class="identifier">s</span><span class="special">,</span> 302 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 303 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 304 </p> 305 </td> 306<td> 307 <p> 308 Attempts to match the current expression against the text <span class="emphasis"><em>s</em></span> 309 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 310 Returns <span class="emphasis"><em>true</em></span> if the expression matches the 311 whole of the input string. 312 </p> 313 </td> 314</tr> 315<tr> 316<td> 317 <p> 318 <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span> 319 <span class="keyword">char</span><span class="special">*</span> 320 <span class="identifier">p</span><span class="special">,</span> 321 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 322 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 323 </p> 324 </td> 325<td> 326 <p> 327 Attempts to find a match for the current expression somewhere 328 in the text <span class="emphasis"><em>p</em></span> using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 329 Returns <span class="emphasis"><em>true</em></span> if the match succeeds. 330 </p> 331 </td> 332</tr> 333<tr> 334<td> 335 <p> 336 <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Search</span><span class="special">(</span><span class="keyword">const</span> 337 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 338 <span class="identifier">s</span><span class="special">,</span> 339 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 340 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 341 </p> 342 </td> 343<td> 344 <p> 345 Attempts to find a match for the current expression somewhere 346 in the text <span class="emphasis"><em>s</em></span> using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags. 347 Returns <span class="emphasis"><em>true</em></span> if the match succeeds. 348 </p> 349 </td> 350</tr> 351<tr> 352<td> 353 <p> 354 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 355 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 356 <span class="keyword">char</span><span class="special">*</span> 357 <span class="identifier">p</span><span class="special">,</span> 358 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 359 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 360 </p> 361 </td> 362<td> 363 <p> 364 Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span> 365 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 366 For each match found calls the call-back function cb as: <code class="computeroutput"><span class="identifier">cb</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span></code> 367 If at any stage the call-back function returns <span class="emphasis"><em>false</em></span> 368 then the grep operation terminates, otherwise continues until 369 no further matches are found. Returns the number of matches found. 370 </p> 371 </td> 372</tr> 373<tr> 374<td> 375 <p> 376 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 377 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">GrepCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 378 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 379 <span class="identifier">s</span><span class="special">,</span> 380 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 381 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 382 </p> 383 </td> 384<td> 385 <p> 386 Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span> 387 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags. 388 For each match found calls the call-back function cb as: <code class="computeroutput"><span class="identifier">cb</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span></code> 389 If at any stage the call-back function returns false then the 390 grep operation terminates, otherwise continues until no further 391 matches are found. Returns the number of matches found. 392 </p> 393 </td> 394</tr> 395<tr> 396<td> 397 <p> 398 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 399 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> 400 <span class="identifier">v</span><span class="special">,</span> 401 <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 402 <span class="identifier">flags</span> <span class="special">=</span> 403 <span class="identifier">match_default</span><span class="special">);</span></code> 404 </p> 405 </td> 406<td> 407 <p> 408 Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span> 409 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> flags. 410 For each match pushes a copy of what matched onto <span class="emphasis"><em>v</em></span>. 411 Returns the number of matches found. 412 </p> 413 </td> 414</tr> 415<tr> 416<td> 417 <p> 418 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 419 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> 420 <span class="identifier">v</span><span class="special">,</span> 421 <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 422 <span class="identifier">flags</span> <span class="special">=</span> 423 <span class="identifier">match_default</span><span class="special">);</span></code> 424 </p> 425 </td> 426<td> 427 <p> 428 Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span> 429 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 430 For each match pushes a copy of what matched onto <span class="emphasis"><em>v</em></span>. 431 Returns the number of matches found. 432 </p> 433 </td> 434</tr> 435<tr> 436<td> 437 <p> 438 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 439 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> 440 <span class="keyword">char</span><span class="special">*</span> 441 <span class="identifier">p</span><span class="special">,</span> 442 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 443 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 444 </p> 445 </td> 446<td> 447 <p> 448 Finds all matches of the current expression in the text <span class="emphasis"><em>p</em></span> 449 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 450 For each match pushes the starting index of what matched onto 451 <span class="emphasis"><em>v</em></span>. Returns the number of matches found. 452 </p> 453 </td> 454</tr> 455<tr> 456<td> 457 <p> 458 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 459 <span class="identifier">Grep</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">const</span> 460 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 461 <span class="identifier">s</span><span class="special">,</span> 462 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 463 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 464 </p> 465 </td> 466<td> 467 <p> 468 Finds all matches of the current expression in the text <span class="emphasis"><em>s</em></span> 469 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 470 For each match pushes the starting index of what matched onto 471 <span class="emphasis"><em>v</em></span>. Returns the number of matches found. 472 </p> 473 </td> 474</tr> 475<tr> 476<td> 477 <p> 478 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 479 <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 480 <span class="keyword">char</span><span class="special">*</span> 481 <span class="identifier">files</span><span class="special">,</span> 482 <span class="keyword">bool</span> <span class="identifier">recurse</span> 483 <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 484 <span class="identifier">flags</span> <span class="special">=</span> 485 <span class="identifier">match_default</span><span class="special">);</span></code> 486 </p> 487 </td> 488<td> 489 <p> 490 Finds all matches of the current expression in the files <span class="emphasis"><em>files</em></span> 491 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 492 For each match calls the call-back function cb. If the call-back 493 returns false then the algorithm returns without considering 494 further matches in the current file, or any further files. 495 </p> 496 <p> 497 The parameter <span class="emphasis"><em>files</em></span> can include wild card 498 characters '*' and '?', if the parameter recurse is true then 499 searches sub-directories for matching file names. 500 </p> 501 <p> 502 Returns the total number of matches found. 503 </p> 504 <p> 505 May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> 506 if file io fails. 507 </p> 508 </td> 509</tr> 510<tr> 511<td> 512 <p> 513 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 514 <span class="identifier">GrepFiles</span><span class="special">(</span><span class="identifier">GrepFileCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 515 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 516 <span class="identifier">files</span><span class="special">,</span> 517 <span class="keyword">bool</span> <span class="identifier">recurse</span> 518 <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 519 <span class="identifier">flags</span> <span class="special">=</span> 520 <span class="identifier">match_default</span><span class="special">);</span></code> 521 </p> 522 </td> 523<td> 524 <p> 525 Finds all matches of the current expression in the files <span class="emphasis"><em>files</em></span> 526 using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 527 For each match calls the call-back function cb. 528 </p> 529 <p> 530 If the call-back returns false then the algorithm returns without 531 considering further matches in the current file, or any further 532 files. 533 </p> 534 <p> 535 The parameter <span class="emphasis"><em>files</em></span> can include wild card 536 characters '*' and '?', if the parameter recurse is true then 537 searches sub-directories for matching file names. 538 </p> 539 <p> 540 Returns the total number of matches found. 541 </p> 542 <p> 543 May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> 544 if file io fails. 545 </p> 546 </td> 547</tr> 548<tr> 549<td> 550 <p> 551 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 552 <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 553 <span class="keyword">char</span><span class="special">*</span> 554 <span class="identifier">files</span><span class="special">,</span> 555 <span class="keyword">bool</span> <span class="identifier">recurse</span> 556 <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 557 <span class="identifier">flags</span> <span class="special">=</span> 558 <span class="identifier">match_default</span><span class="special">);</span></code> 559 </p> 560 </td> 561<td> 562 <p> 563 Searches files to find all those which contain at least one match 564 of the current expression using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 565 For each matching file calls the call-back function cb. If the 566 call-back returns false then the algorithm returns without considering 567 any further files. 568 </p> 569 <p> 570 The parameter <span class="emphasis"><em>files</em></span> can include wild card 571 characters '*' and '?', if the parameter <span class="emphasis"><em>recurse</em></span> 572 is true then searches sub-directories for matching file names. 573 </p> 574 <p> 575 Returns the total number of files found. 576 </p> 577 <p> 578 May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> 579 if file io fails. 580 </p> 581 </td> 582</tr> 583<tr> 584<td> 585 <p> 586 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 587 <span class="identifier">FindFiles</span><span class="special">(</span><span class="identifier">FindFilesCallback</span> <span class="identifier">cb</span><span class="special">,</span> <span class="keyword">const</span> 588 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 589 <span class="identifier">files</span><span class="special">,</span> 590 <span class="keyword">bool</span> <span class="identifier">recurse</span> 591 <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 592 <span class="identifier">flags</span> <span class="special">=</span> 593 <span class="identifier">match_default</span><span class="special">);</span></code> 594 </p> 595 </td> 596<td> 597 <p> 598 Searches files to find all those which contain at least one match 599 of the current expression using the <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a> <span class="emphasis"><em>flags</em></span>. 600 For each matching file calls the call-back function cb. 601 </p> 602 <p> 603 If the call-back returns false then the algorithm returns without 604 considering any further files. 605 </p> 606 <p> 607 The parameter <span class="emphasis"><em>files</em></span> can include wild card 608 characters '*' and '?', if the parameter <span class="emphasis"><em>recurse</em></span> 609 is true then searches sub-directories for matching file names. 610 </p> 611 <p> 612 Returns the total number of files found. 613 </p> 614 <p> 615 May throw an exception derived from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> 616 if file io fails. 617 </p> 618 </td> 619</tr> 620<tr> 621<td> 622 <p> 623 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span> 624 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> 625 <span class="identifier">in</span><span class="special">,</span> 626 <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="keyword">bool</span> 627 <span class="identifier">copy</span> <span class="special">=</span> 628 <span class="keyword">true</span><span class="special">,</span> 629 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 630 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 631 </p> 632 </td> 633<td> 634 <p> 635 Performs a search and replace operation: searches through the 636 string <span class="emphasis"><em>in</em></span> for all occurrences of the current 637 expression, for each occurrence replaces the match with the format 638 string <span class="emphasis"><em>fmt</em></span>. Uses <span class="emphasis"><em>flags</em></span> 639 to determine what gets matched, and how the format string should 640 be treated. If <span class="emphasis"><em>copy</em></span> is true then all unmatched 641 sections of input are copied unchanged to output, if the flag 642 <span class="emphasis"><em>format_first_only</em></span> is set then only the first 643 occurrence of the pattern found is replaced. Returns the new 644 string. See also <a class="link" href="../../format.html" title="Search and Replace Format String Syntax">format string 645 syntax</a>, and <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>. 646 </p> 647 </td> 648</tr> 649<tr> 650<td> 651 <p> 652 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">Merge</span><span class="special">(</span><span class="keyword">const</span> 653 <span class="keyword">char</span><span class="special">*</span> 654 <span class="identifier">in</span><span class="special">,</span> 655 <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">fmt</span><span class="special">,</span> <span class="keyword">bool</span> 656 <span class="identifier">copy</span> <span class="special">=</span> 657 <span class="keyword">true</span><span class="special">,</span> 658 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">flags</span> 659 <span class="special">=</span> <span class="identifier">match_default</span><span class="special">);</span></code> 660 </p> 661 </td> 662<td> 663 <p> 664 Performs a search and replace operation: searches through the 665 string <span class="emphasis"><em>in</em></span> for all occurrences of the current 666 expression, for each occurrence replaces the match with the format 667 string <span class="emphasis"><em>fmt</em></span>. Uses <span class="emphasis"><em>flags</em></span> 668 to determine what gets matched, and how the format string should 669 be treated. If <span class="emphasis"><em>copy</em></span> is true then all unmatched 670 sections of input are copied unchanged to output, if the flag 671 <span class="emphasis"><em>format_first_only</em></span> is set then only the first 672 occurrence of the pattern found is replaced. Returns the new 673 string. See also <a class="link" href="../../format.html" title="Search and Replace Format String Syntax">format string 674 syntax</a>, and <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>. 675 </p> 676 </td> 677</tr> 678<tr> 679<td> 680 <p> 681 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="identifier">Split</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>&</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">match_flag_type</span> 682 <span class="identifier">flags</span> <span class="special">=</span> 683 <span class="identifier">match_default</span><span class="special">,</span> 684 <span class="keyword">unsigned</span> <span class="identifier">max_count</span> 685 <span class="special">=</span> <span class="special">~</span><span class="number">0</span><span class="special">);</span></code> 686 </p> 687 </td> 688<td> 689 <p> 690 Splits the input string and pushes each one onto the vector. 691 If the expression contains no marked sub-expressions, then one 692 string is outputted for each section of the input that does not 693 match the expression. If the expression does contain marked sub-expressions, 694 then outputs one string for each marked sub-expression each time 695 a match occurs. Outputs no more than <span class="emphasis"><em>max_count</em></span> 696 strings. Before returning, deletes from the input string <span class="emphasis"><em>s</em></span> 697 all of the input that has been processed (all of the string if 698 <span class="emphasis"><em>max_count</em></span> was not reached). Returns the 699 number of strings pushed onto the vector. 700 </p> 701 </td> 702</tr> 703<tr> 704<td> 705 <p> 706 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 707 <span class="identifier">Position</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> 708 <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code> 709 </p> 710 </td> 711<td> 712 <p> 713 Returns the position of what matched sub-expression <span class="emphasis"><em>i</em></span>. 714 If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span> 715 <span class="number">0</span></code> then returns the position 716 of the whole match. Returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code> 717 if the supplied index is invalid, or if the specified sub-expression 718 did not participate in the match. 719 </p> 720 </td> 721</tr> 722<tr> 723<td> 724 <p> 725 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 726 <span class="identifier">Length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> 727 <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code> 728 </p> 729 </td> 730<td> 731 <p> 732 Returns the length of what matched sub-expression i. If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span> 733 <span class="number">0</span></code> then returns the length 734 of the whole match. Returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code> 735 if the supplied index is invalid, or if the specified sub-expression 736 did not participate in the match. 737 </p> 738 </td> 739</tr> 740<tr> 741<td> 742 <p> 743 <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">Matched</span><span class="special">(</span><span class="keyword">int</span> 744 <span class="identifier">i</span> <span class="special">=</span> 745 <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code> 746 </p> 747 </td> 748<td> 749 <p> 750 Returns true if sub-expression <span class="emphasis"><em>i</em></span> was matched, 751 false otherwise. 752 </p> 753 </td> 754</tr> 755<tr> 756<td> 757 <p> 758 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 759 <span class="identifier">Line</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span></code> 760 </p> 761 </td> 762<td> 763 <p> 764 Returns the line on which the match occurred, indexes start from 765 1 not zero, if no match occurred then returns <code class="computeroutput"><span class="identifier">RegEx</span><span class="special">::</span><span class="identifier">npos</span></code>. 766 </p> 767 </td> 768</tr> 769<tr> 770<td> 771 <p> 772 <code class="computeroutput"><span class="keyword">unsigned</span> <span class="keyword">int</span> 773 <span class="identifier">Marks</span><span class="special">()</span> 774 <span class="keyword">const</span><span class="special">;</span></code> 775 </p> 776 </td> 777<td> 778 <p> 779 Returns the number of marked sub-expressions contained in the 780 expression. Note that this includes the whole match (sub-expression 781 zero), so the value returned is always >= 1. 782 </p> 783 </td> 784</tr> 785<tr> 786<td> 787 <p> 788 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">What</span><span class="special">(</span><span class="keyword">int</span> 789 <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span></code> 790 </p> 791 </td> 792<td> 793 <p> 794 Returns a copy of what matched sub-expression <span class="emphasis"><em>i</em></span>. 795 If <code class="computeroutput"><span class="identifier">i</span> <span class="special">=</span> 796 <span class="number">0</span></code> then returns a copy of 797 the whole match. Returns a null string if the index is invalid 798 or if the specified sub-expression did not participate in a match. 799 </p> 800 </td> 801</tr> 802<tr> 803<td> 804 <p> 805 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span> 806 <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span> <span class="special">;</span></code> 807 </p> 808 </td> 809<td> 810 <p> 811 Returns <code class="computeroutput"><span class="identifier">what</span><span class="special">(</span><span class="identifier">i</span><span class="special">);</span></code> Can be used to simplify access 812 to sub-expression matches, and make usage more perl-like. 813 </p> 814 </td> 815</tr> 816</tbody> 817</table></div> 818</div> 819<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 820<td align="left"></td> 821<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p> 822 Distributed under the Boost Software License, Version 1.0. (See accompanying 823 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 824 </p> 825</div></td> 826</tr></table> 827<hr> 828<div class="spirit-nav"> 829<a accesskey="p" href="regex_split.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../internals.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 830</div> 831</body> 832</html> 833