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
This replaces GBP if it's preceded by the start of a string or a word boundary (which the start of a string already is), and after GBP comes a numeric value or a word boundary:
re.sub(u'\bGBP(?=\b|\d)', u'£', text)
This removes the need for any unnecessary backreferencing by using a lookahead. Inclusive enough?