]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | Copyright 2006-2007 John Maddock. | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | ||
9 | [section:regex_format regex_format (Deprecated)] | |
10 | ||
11 | The algorithm `regex_format` is deprecated; new code should use | |
12 | [match_results_format] instead. Existing code will continue to compile, | |
13 | the following documentation is taken from the previous version of Boost.Regex and | |
14 | will not be further updated: | |
15 | ||
16 | [h4 Algorithm regex_format] | |
17 | ||
18 | #include <boost/regex.hpp> | |
19 | ||
20 | The algorithm `regex_format` takes the results of a match and creates a | |
21 | new string based upon a format string, `regex_format` can be used for | |
22 | search and replace operations: | |
23 | ||
24 | template <class OutputIterator, class iterator, class Allocator, class Formatter> | |
25 | OutputIterator regex_format(OutputIterator out, | |
26 | const match_results<iterator, Allocator>& m, | |
27 | Formatter fmt, | |
28 | match_flag_type flags = 0); | |
29 | ||
30 | The library also defines the following convenience variation of | |
31 | `regex_format`, which returns the result directly as a string, rather | |
32 | than outputting to an iterator. | |
33 | ||
34 | [note This version may not be available, or may be available in a more limited | |
35 | form, depending upon your compilers capabilities] | |
36 | ||
37 | template <class iterator, class Allocator, class Formatter> | |
38 | std::basic_string<charT> regex_format | |
39 | (const match_results<iterator, Allocator>& m, | |
40 | Formatter fmt, | |
41 | match_flag_type flags = 0); | |
42 | ||
43 | Parameters to the main version of the function are passed as follows: | |
44 | ||
45 | [table | |
46 | [[Parameter][Description]] | |
47 | [[`OutputIterator out`][An output iterator type, the output string is sent to this iterator. Typically this would be a std::ostream_iterator. ]] | |
48 | [[`const match_results<iterator, Allocator>& m`][An instance of [match_results] obtained from one of the matching algorithms above, and denoting what matched. ]] | |
49 | [[`Formatter fmt`][Either a format string that determines how the match is transformed into the new string, or a functor that computes the new string from /m/ - see [match_results_format]. ]] | |
50 | [[`unsigned flags`][Optional flags which describe how the format string is to be interpreted. ]] | |
51 | ] | |
52 | ||
53 | Format flags are described under [match_flag_type]. | |
54 | ||
55 | The format string syntax (and available options) is described more fully | |
56 | under [link boost_regex.format format strings]. | |
57 | ||
58 | [endsect] | |
59 |