The std::regex_replace() algorithm has several overloads with different types of parameters, but the meaning of the parameters is as follows:
- The input string on which the replacement is performed.
- An std::basic_regex object that encapsulates the regular expression used to identify the parts of the strings to be replaced.
- The string format used for replacement.
- Optional matching flags.
The return value is, depending on the overload used, either a string or a copy of the output iterator provided as an argument. The string format used for replacement can either be a simple string or a match identifier indicated with a $ prefix:
- $& indicates the entire match.
- $1, $2, $3, and so on, indicate the first, second, third submatch, ...