Replace

Along with searching, you can also alter the text if it matches your regex condition.

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

Get hands-on with 1200+ tech skills courses.