import re


r = re.compile(r'(hello|world)')


string = 'hello world the World!!'

print(re.sub(r, r'fuck.\1', string))

