import re
string1 = 'NAME is foo'
string2 = 'GAME is bar'
re.findall(r'NAME|GAME(\D*)',str1)
Expected output is it should work for either of the keyword and produce the output accordingly like for string1 it should be 'is foo' and for string2 it should be 'is bar'.