Home | Libraries | People | FAQ | More |
The algorithm regex_format
is deprecated; new code should use match_results<>::format
instead. Existing code
will continue to compile, the following documentation is taken from the
previous version of Boost.Regex and will not be further updated:
#include <boost/regex.hpp>
The algorithm regex_format
takes the results of a match and creates a new string based upon a format
string, regex_format
can
be used for search and replace operations:
template <class OutputIterator, class iterator, class Allocator, class Formatter> OutputIterator regex_format(OutputIterator out, const match_results<iterator, Allocator>& m, Formatter fmt, match_flag_type flags = 0);
The library also defines the following convenience variation of regex_format
, which returns the result
directly as a string, rather than outputting to an iterator.
Note | |
---|---|
This version may not be available, or may be available in a more limited form, depending upon your compilers capabilities |
template <class iterator, class Allocator, class Formatter> std::basic_string<charT> regex_format (const match_results<iterator, Allocator>& m, Formatter fmt, match_flag_type flags = 0);
Parameters to the main version of the function are passed as follows:
Parameter |
Description |
---|---|
|
An output iterator type, the output string is sent to this iterator. Typically this would be a std::ostream_iterator. |
|
An instance of |
|
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 |
|
Optional flags which describe how the format string is to be interpreted. |
Format flags are described under match_flag_type
.
The format string syntax (and available options) is described more fully under format strings.