forked from boostorg/regex
Merge bug fixes from Trunk - see history for full details.
[SVN r58234]
This commit is contained in:
@ -18,34 +18,37 @@ output unchanged only if the /flags/ parameter does not have the
|
||||
flag `format_no_copy` set. If the flag `format_first_only` is set then
|
||||
only the first occurrence is replaced rather than all occurrences.
|
||||
|
||||
template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
|
||||
template <class OutputIterator, class BidirectionalIterator, class traits, class Formatter>
|
||||
OutputIterator regex_replace(OutputIterator out,
|
||||
BidirectionalIterator first,
|
||||
BidirectionalIterator last,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
Formatter fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
template <class traits, class charT>
|
||||
template <class traits, class Formatter>
|
||||
basic_string<charT> regex_replace(const basic_string<charT>& s,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
Formatter fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
|
||||
[h4 Description]
|
||||
|
||||
template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
|
||||
template <class OutputIterator, class BidirectionalIterator, class traits, class Formatter>
|
||||
OutputIterator regex_replace(OutputIterator out,
|
||||
BidirectionalIterator first,
|
||||
BidirectionalIterator last,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
Formatter fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
Enumerates all the occurences of expression /e/ in the sequence \[first, last),
|
||||
replacing each occurence with the string that results by merging the
|
||||
match found with the format string /fmt/, and copies the resulting string to /out/.
|
||||
In the case that /fmt/ is a unary, binary or ternary function object, then the
|
||||
character sequence generated by that object is copied unchanged to the output when performing
|
||||
a substitution.
|
||||
|
||||
If the flag `format_no_copy` is set in /flags/ then unmatched sections of
|
||||
text are not copied to output.
|
||||
@ -57,6 +60,17 @@ The manner in which the format string /fmt/ is interpretted, along with the
|
||||
rules used for finding matches, are determined by the flags set in /flags/:
|
||||
see [match_flag_type].
|
||||
|
||||
[*Requires]
|
||||
The type `Formatter` must be either a pointer to a null-terminated string
|
||||
of type `char_type[]`, or be a container of `char_type`'s (for example
|
||||
`std::basic_string<char_type>`) or be a unary, binary or ternary functor
|
||||
that computes the replacement string from a function call: either
|
||||
`fmt(what)` which must return a container of `char_type`'s to be used as the
|
||||
replacement text, or either `fmt(what, out)` or `fmt(what, out, flags)`, both of
|
||||
which write the replacement text to `*out`, and then return the new
|
||||
OutputIterator position. In each case `what` is the [match_results] object
|
||||
that represents the match found.
|
||||
|
||||
[*Effects]: Constructs an [regex_iterator] object:
|
||||
|
||||
regex_iterator<BidirectionalIterator, charT, traits, Allocator>
|
||||
@ -107,12 +121,23 @@ memory allocation (if Boost.Regex is configured in non-recursive mode).
|
||||
|
||||
[*Returns]: out.
|
||||
|
||||
template <class traits, class charT>
|
||||
template <class traits, class Formatter>
|
||||
basic_string<charT> regex_replace(const basic_string<charT>& s,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const basic_string<charT>& fmt,
|
||||
Formatter fmt,
|
||||
match_flag_type flags = match_default);
|
||||
|
||||
[*Requires]
|
||||
The type `Formatter` must be either a pointer to a null-terminated string
|
||||
of type `char_type[]`, or be a container of `char_type`'s (for example
|
||||
`std::basic_string<char_type>`) or be a unary, binary or ternary functor
|
||||
that computes the replacement string from a function call: either
|
||||
`fmt(what)` which must return a container of `char_type`'s to be used as the
|
||||
replacement text, or either `fmt(what, out)` or `fmt(what, out, flags)`, both of
|
||||
which write the replacement text to `*out`, and then return the new
|
||||
OutputIterator position. In each case `what` is the [match_results] object
|
||||
that represents the match found.
|
||||
|
||||
[*Effects]: Constructs an object `basic_string<charT> result`, calls
|
||||
`regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags)`,
|
||||
and then returns `result`.
|
||||
|
Reference in New Issue
Block a user