bbelderbos, In #Python you can use
sub()
from the "re" module to do regex string replacing.If you want to keep a count of the number of replacements done as well, you can use
subn()
which returns a tuple of the new (replaced) string and the number of replacements made.For example: