lines = ['Hey, how are you?\n', 'My name is Mathews.\n',
    'I hate vegetables\n', """French fries came out soggy
"""]
for line in lines:
    for word in re.findall('\\w+(?:\\?|\\.|gy\\b)', line):
        pass
String comparison in python words ending with