Remove repeated re.sub() calls

Briefly tested - please test more