import re r = re.compile(r'hello|world') string = 'hello world the World!!' print(re.sub(r, 'fuck', string))
Standard input is empty
fuck fuck the World!!
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!