Format
Regular expressions can also specify the format of the target text. Find the implementation below.
std::regex_replace
and std::match_results.format
in combination with capture groups enables you to format text. You can use a format string together with a placeholder to insert the value.
Here are both possibilities: