| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|---|
| 4 | <title>Function regex_replace</title> |
|---|
| 5 | <link rel="stylesheet" href="../../boostbook.css" type="text/css"> |
|---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> |
|---|
| 7 | <link rel="start" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
|---|
| 8 | <link rel="up" href="../../xpressive/reference.html#header.boost.xpressive.regex_algorithms.hpp" title="Header <boost/xpressive/regex_algorithms.hpp>"> |
|---|
| 9 | <link rel="prev" href="regex_search.html" title="Function regex_search"> |
|---|
| 10 | <link rel="next" href="regex_compiler.html" title="Struct template regex_compiler"> |
|---|
| 11 | </head> |
|---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
|---|
| 13 | <table cellpadding="2" width="100%"> |
|---|
| 14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> |
|---|
| 15 | <td align="center"><a href="../../../../index.htm">Home</a></td> |
|---|
| 16 | <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> |
|---|
| 17 | <td align="center"><a href="../../../../people/people.htm">People</a></td> |
|---|
| 18 | <td align="center"><a href="../../../../more/faq.htm">FAQ</a></td> |
|---|
| 19 | <td align="center"><a href="../../../../more/index.htm">More</a></td> |
|---|
| 20 | </table> |
|---|
| 21 | <hr> |
|---|
| 22 | <div class="spirit-nav"> |
|---|
| 23 | <a accesskey="p" href="regex_search.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.regex_algorithms.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="regex_compiler.html"><img src="../../images/next.png" alt="Next"></a> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="refentry" lang="en"> |
|---|
| 26 | <a name="boost.xpressive.regex_replace"></a><div class="titlepage"></div> |
|---|
| 27 | <div class="refnamediv"> |
|---|
| 28 | <h2><span class="refentrytitle">Function regex_replace</span></h2> |
|---|
| 29 | <p>boost::xpressive::regex_replace — Build an output sequence given an input sequence, a regex, and a format string. </p> |
|---|
| 30 | </div> |
|---|
| 31 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
|---|
| 32 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"> |
|---|
| 33 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> OutIter, <span class="bold"><strong>typename</strong></span> OtherBidiIter, <span class="bold"><strong>typename</strong></span> BidiIter> |
|---|
| 34 | <span class="type">OutIter</span> regex_replace(OutIter out, OtherBidiIter begin, OtherBidiIter end, |
|---|
| 35 | <a href="basic_regex.html" title="Struct template basic_regex">basic_regex</a>< BidiIter > <span class="bold"><strong>const</strong></span> & re, |
|---|
| 36 | std::basic_string< <span class="bold"><strong>typename</strong></span> iterator_value< BidiIter >::type > <span class="bold"><strong>const</strong></span> & fmt, |
|---|
| 37 | regex_constants::match_flag_type flags = regex_constants::match_default); |
|---|
| 38 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Char> |
|---|
| 39 | <span class="type">std::basic_string< Char ></span> |
|---|
| 40 | regex_replace(std::basic_string< Char > <span class="bold"><strong>const</strong></span> & str, |
|---|
| 41 | <a href="basic_regex.html" title="Struct template basic_regex">basic_regex</a>< <span class="bold"><strong>typename</strong></span> std::basic_string< Char >::const_iterator > <span class="bold"><strong>const</strong></span> & re, |
|---|
| 42 | std::basic_string< Char > <span class="bold"><strong>const</strong></span> & fmt, |
|---|
| 43 | regex_constants::match_flag_type flags = regex_constants::match_default);</pre></div> |
|---|
| 44 | <div class="refsect1" lang="en"> |
|---|
| 45 | <a name="id2023986"></a><h2>Description</h2> |
|---|
| 46 | <p>Constructs a regex_iterator object: regex_iterator< BidiIter > i(begin, end, re, flags), and uses i to enumerate through all of the matches m of type match_results< BidiIter > that occur within the sequence [begin, end). If no such matches are found and !(flags & format_no_copy) then calls std::copy(begin, end, out). Otherwise, for each match found, if !(flags & format_no_copy) calls std::copy(m.prefix().first, m.prefix().second, out), and then calls m.format(out, fmt, flags). Finally if !(flags & format_no_copy) calls std::copy(last_m.suffix().first, last_m.suffix().second, out) where last_m is a copy of the last match found. If flags & format_first_only is non-zero then only the first match found is replaced.</p> |
|---|
| 47 | <p> |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | </p> |
|---|
| 52 | <div class="variablelist"><table border="0"> |
|---|
| 53 | <col align="left" valign="top"> |
|---|
| 54 | <tbody> |
|---|
| 55 | <tr> |
|---|
| 56 | <td> |
|---|
| 57 | <span class="term">Parameters:</span></td> |
|---|
| 58 | <td><div class="variablelist"><table border="0"> |
|---|
| 59 | <col align="left" valign="top"> |
|---|
| 60 | <tbody> |
|---|
| 61 | <tr> |
|---|
| 62 | <td> |
|---|
| 63 | <span class="term"><code class="computeroutput">begin</code></span></td> |
|---|
| 64 | <td><p>The beginning of the input sequence. </p></td> |
|---|
| 65 | </tr> |
|---|
| 66 | <tr> |
|---|
| 67 | <td> |
|---|
| 68 | <span class="term"><code class="computeroutput">end</code></span></td> |
|---|
| 69 | <td><p>The end of the input sequence. </p></td> |
|---|
| 70 | </tr> |
|---|
| 71 | <tr> |
|---|
| 72 | <td> |
|---|
| 73 | <span class="term"><code class="computeroutput">flags</code></span></td> |
|---|
| 74 | <td><p>Optional match flags, used to control how the expression is matched against the sequence. (See match_flag_type.) </p></td> |
|---|
| 75 | </tr> |
|---|
| 76 | <tr> |
|---|
| 77 | <td> |
|---|
| 78 | <span class="term"><code class="computeroutput">fmt</code></span></td> |
|---|
| 79 | <td><p>The format string used to format the replacement sequence. </p></td> |
|---|
| 80 | </tr> |
|---|
| 81 | <tr> |
|---|
| 82 | <td> |
|---|
| 83 | <span class="term"><code class="computeroutput">out</code></span></td> |
|---|
| 84 | <td><p>An output iterator into which the output sequence is written. </p></td> |
|---|
| 85 | </tr> |
|---|
| 86 | <tr> |
|---|
| 87 | <td> |
|---|
| 88 | <span class="term"><code class="computeroutput">re</code></span></td> |
|---|
| 89 | <td><p>The regular expression object to use. </p></td> |
|---|
| 90 | </tr> |
|---|
| 91 | </tbody> |
|---|
| 92 | </table></div></td> |
|---|
| 93 | </tr> |
|---|
| 94 | <tr> |
|---|
| 95 | <td> |
|---|
| 96 | <span class="term">Requires:</span></td> |
|---|
| 97 | <td> |
|---|
| 98 | <p>Types BidiIter and OtherBidiIter meet the requirements of a Bidirectional Iterator (24.1.4). </p> |
|---|
| 99 | <p>Type OutIter meets the requirements of an Output Iterator (24.1.2). </p> |
|---|
| 100 | <p>OtherBidiIter is convertible to BidiIter. </p> |
|---|
| 101 | <p>[begin,end) denotes a valid iterator range.</p> |
|---|
| 102 | </td> |
|---|
| 103 | </tr> |
|---|
| 104 | <tr> |
|---|
| 105 | <td> |
|---|
| 106 | <span class="term">Returns:</span></td> |
|---|
| 107 | <td><p>The value of the output iterator after the output sequence has been written to it. </p></td> |
|---|
| 108 | </tr> |
|---|
| 109 | <tr> |
|---|
| 110 | <td> |
|---|
| 111 | <span class="term">Throws:</span></td> |
|---|
| 112 | <td> |
|---|
| 113 | <a href="regex_error.html" title="Struct regex_error">regex_error</a> on stack exhaustion or invalid format string. </td> |
|---|
| 114 | </tr> |
|---|
| 115 | </tbody> |
|---|
| 116 | </table></div> |
|---|
| 117 | </div> |
|---|
| 118 | </div> |
|---|
| 119 | <table width="100%"><tr> |
|---|
| 120 | <td align="left"></td> |
|---|
| 121 | <td align="right"><small>Copyright © 2003, 2004 Eric Niebler</small></td> |
|---|
| 122 | </tr></table> |
|---|
| 123 | <hr> |
|---|
| 124 | <div class="spirit-nav"> |
|---|
| 125 | <a accesskey="p" href="regex_search.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.regex_algorithms.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="regex_compiler.html"><img src="../../images/next.png" alt="Next"></a> |
|---|
| 126 | </div> |
|---|
| 127 | </body> |
|---|
| 128 | </html> |
|---|