3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>regex_format (Deprecated)
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../../index.html" title=
"Boost.Regex 5.1.2">
8 <link rel=
"up" href=
"../deprecated_interfaces.html" title=
"Deprecated Interfaces">
9 <link rel=
"prev" href=
"../deprecated_interfaces.html" title=
"Deprecated Interfaces">
10 <link rel=
"next" href=
"regex_grep.html" title=
"regex_grep (Deprecated)">
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>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"../deprecated_interfaces.html"><img src=
"../../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../deprecated_interfaces.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=
"regex_grep.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h4 class=
"title">
27 <a name=
"boost_regex.ref.deprecated_interfaces.regex_format"></a><a class=
"link" href=
"regex_format.html" title=
"regex_format (Deprecated)">regex_format
29 </h4></div></div></div>
31 The algorithm
<code class=
"computeroutput"><span class=
"identifier">regex_format
</span></code>
32 is deprecated; new code should use
<a class=
"link" href=
"../match_results.html#boost_regex.match_results_format"><code class=
"computeroutput"><span class=
"identifier">match_results
</span><span class=
"special"><>::
</span><span class=
"identifier">format
</span></code></a> instead. Existing code
33 will continue to compile, the following documentation is taken from the
34 previous version of Boost.Regex and will not be further updated:
37 <a name=
"boost_regex.ref.deprecated_interfaces.regex_format.h0"></a>
38 <span class=
"phrase"><a name=
"boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format"></a></span><a class=
"link" href=
"regex_format.html#boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format">Algorithm
41 <pre class=
"programlisting"><span class=
"preprocessor">#include
</span> <span class=
"special"><</span><span class=
"identifier">boost
</span><span class=
"special">/
</span><span class=
"identifier">regex
</span><span class=
"special">.
</span><span class=
"identifier">hpp
</span><span class=
"special">></span>
44 The algorithm
<code class=
"computeroutput"><span class=
"identifier">regex_format
</span></code>
45 takes the results of a match and creates a new string based upon a format
46 string,
<code class=
"computeroutput"><span class=
"identifier">regex_format
</span></code> can
47 be used for search and replace operations:
49 <pre class=
"programlisting"><span class=
"keyword">template
</span> <span class=
"special"><</span><span class=
"keyword">class
</span> <span class=
"identifier">OutputIterator
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <span class=
"identifier">iterator
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <span class=
"identifier">Allocator
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <span class=
"identifier">Formatter
</span><span class=
"special">></span>
50 <span class=
"identifier">OutputIterator
</span> <span class=
"identifier">regex_format
</span><span class=
"special">(
</span><span class=
"identifier">OutputIterator
</span> <span class=
"identifier">out
</span><span class=
"special">,
</span>
51 <span class=
"keyword">const
</span> <span class=
"identifier">match_results
</span><span class=
"special"><</span><span class=
"identifier">iterator
</span><span class=
"special">,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">>&</span> <span class=
"identifier">m
</span><span class=
"special">,
</span>
52 <span class=
"identifier">Formatter
</span> <span class=
"identifier">fmt
</span><span class=
"special">,
</span>
53 <span class=
"identifier">match_flag_type
</span> <span class=
"identifier">flags
</span> <span class=
"special">=
</span> <span class=
"number">0</span><span class=
"special">);
</span>
56 The library also defines the following convenience variation of
<code class=
"computeroutput"><span class=
"identifier">regex_format
</span></code>, which returns the result
57 directly as a string, rather than outputting to an iterator.
59 <div class=
"note"><table border=
"0" summary=
"Note">
61 <td rowspan=
"2" align=
"center" valign=
"top" width=
"25"><img alt=
"[Note]" src=
"../../../../../../../doc/src/images/note.png"></td>
62 <th align=
"left">Note
</th>
64 <tr><td align=
"left" valign=
"top"><p>
65 This version may not be available, or may be available in a more limited
66 form, depending upon your compilers capabilities
69 <pre class=
"programlisting"><span class=
"keyword">template
</span> <span class=
"special"><</span><span class=
"keyword">class
</span> <span class=
"identifier">iterator
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <span class=
"identifier">Allocator
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <span class=
"identifier">Formatter
</span><span class=
"special">></span>
70 <span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">basic_string
</span><span class=
"special"><</span><span class=
"identifier">charT
</span><span class=
"special">></span> <span class=
"identifier">regex_format
</span>
71 <span class=
"special">(
</span><span class=
"keyword">const
</span> <span class=
"identifier">match_results
</span><span class=
"special"><</span><span class=
"identifier">iterator
</span><span class=
"special">,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">>&</span> <span class=
"identifier">m
</span><span class=
"special">,
</span>
72 <span class=
"identifier">Formatter
</span> <span class=
"identifier">fmt
</span><span class=
"special">,
</span>
73 <span class=
"identifier">match_flag_type
</span> <span class=
"identifier">flags
</span> <span class=
"special">=
</span> <span class=
"number">0</span><span class=
"special">);
</span>
76 Parameters to the main version of the function are passed as follows:
78 <div class=
"informaltable"><table class=
"table">
99 <code class=
"computeroutput"><span class=
"identifier">OutputIterator
</span> <span class=
"identifier">out
</span></code>
104 An output iterator type, the output string is sent to this iterator.
105 Typically this would be a std::ostream_iterator.
112 <code class=
"computeroutput"><span class=
"keyword">const
</span> <span class=
"identifier">match_results
</span><span class=
"special"><</span><span class=
"identifier">iterator
</span><span class=
"special">,
</span> <span class=
"identifier">Allocator
</span><span class=
"special">>&</span> <span class=
"identifier">m
</span></code>
117 An instance of
<a class=
"link" href=
"../match_results.html" title=
"match_results"><code class=
"computeroutput"><span class=
"identifier">match_results
</span></code></a> obtained
118 from one of the matching algorithms above, and denoting what
126 <code class=
"computeroutput"><span class=
"identifier">Formatter
</span> <span class=
"identifier">fmt
</span></code>
131 Either a format string that determines how the match is transformed
132 into the new string, or a functor that computes the new string
133 from
<span class=
"emphasis"><em>m
</em></span> - see
<a class=
"link" href=
"../match_results.html#boost_regex.match_results_format"><code class=
"computeroutput"><span class=
"identifier">match_results
</span><span class=
"special"><>::
</span><span class=
"identifier">format
</span></code></a>.
140 <code class=
"computeroutput"><span class=
"keyword">unsigned
</span> <span class=
"identifier">flags
</span></code>
145 Optional flags which describe how the format string is to be
153 Format flags are described under
<a class=
"link" href=
"../match_flag_type.html" title=
"match_flag_type"><code class=
"computeroutput"><span class=
"identifier">match_flag_type
</span></code></a>.
156 The format string syntax (and available options) is described more fully
157 under
<a class=
"link" href=
"../../format.html" title=
"Search and Replace Format String Syntax">format strings
</a>.
160 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
161 <td align=
"left"></td>
162 <td align=
"right"><div class=
"copyright-footer">Copyright
© 1998-
2013 John Maddock
<p>
163 Distributed under the Boost Software License, Version
1.0. (See accompanying
164 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>)
169 <div class=
"spirit-nav">
170 <a accesskey=
"p" href=
"../deprecated_interfaces.html"><img src=
"../../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../deprecated_interfaces.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=
"regex_grep.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>