Conceptual

Substituting Text with re.sub in Python

re.sub replaces every match of a pattern with a replacement string, and the replacement can reference capture groups. It is the regex operation that changes data rather than just finding it, which makes it the workhorse of text normalisation.