Can a regular expression match whitespace or the start of a string?
I\'m trying to replace currency the abbreviation GBP with a £ symbol. I
Use the OR "|" operator:
|
>>> re.sub(r'(^|\W)GBP([\W\d])', u'\g<1>£\g<2>', text) u'\xa3 5 Off when you spend \xa375.00'