std::regex_replace
From Cppreference
C++ Standard Library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Regular expressions library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <regex>
|
||
template< class OutputIterator, class BidirectionalIterator,
class Traits, class CharT, |
(1) | (C++11 feature) |
template< class OutputIterator, class BidirectionalIterator,
class Traits, class CharT > |
(2) | (C++11 feature) |
template< class Traits, class CharT,
class STraits, class SAlloc, |
(3) | (C++11 feature) |
template< class Traits, class CharT,
class STraits, class SAlloc > |
(4) | (C++11 feature) |
template< class Traits, class CharT,
class STraits, class SAlloc > |
(5) | (C++11 feature) |
template< class Traits, class CharT >
std::basic_string<CharT> |
(6) | (C++11 feature) |
1) Constructs a std::regex_iterator object i as if by std::regex_iterator<BidirectionalIterator, CharT, traits> i(first, last, e, flags), and uses i to enumerate through all of the matches m of type std::match_results<BidirectionalIterator> that occur within the sequence [first,last ).
2) Same as (1).
3) Constructs an empty string result of type std::basic_string<CharT, ST, SA> and calls std::regex_replace(std::back_inserter(result), s.begin(), s.end(), e, fmt, flags).
4) Same as (3).
5) Constructs an empty string result of type std::basic_string<CharT> and calls std::regex_replace(std::back_inserter(result), s, s + std::char_traits<CharT>::length(s), e, fmt, flags).
6) Same as (5).
[edit] Parameters
out | - | an output iterator with the result | ||
first, last | - | the target character range | ||
m | - | the match results | ||
fmt | - | a regex replacement format string
|
||
s | - | a target character std::basic_string | ||
e | - | the std::regex | ||
flags | - | the match flags |
[edit] Return value
Returns the result containing the replacements.
[edit] See also
std::regex_constants::match_flag_type | |
std::basic_regex | |
std::regex_iterator |