Replace

Along with searching, we can also alter the text if it matches our regex condition.

std::regex_replace replaces sequences in a text that match a text pattern. It returns its result in the simple form std::regex_replace(text, regex, replString) as a string. The function replaces an occurrence of regex in text with replString.

Get hands-on with 1200+ tech skills courses.