sub « Regular Expressions « Python Tutorial






16.7.sub
16.7.1.re.sub substitutes the leftmost, nonoverlapping occurrences of a pattern with a given replacement
16.7.2.Matching at the End of a String
16.7.3.Matching Whole Words
16.7.4.Searching and Replacing with sub() [and subn()]