import retext = 'foo42buz'pattern = re.compile(r'(\d+)buz')text = pattern.sub('bar', text)print(text)
Standard input is empty
foobar
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!