import rerx = r'(?<!\S)GBP([\W\d])'text = 'GBP 5 Off when you spend GBP75.00'print( re.sub(rx, r'£\1', text) )
Standard input is empty
£ 5 Off when you spend £75.00
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!