I have a string
x = 'hamachi, salmon, tuna with salad, and special sauce.'
list of words
mylist = ['salmon','tuna',chicken','potato','onion','ham']
what I need as output is
['salmon','tuna']
I tried
final_list = re.findall(r"(?=("+'|'.join(mylist)+r"))", x)
but the output i got is
['ham', 'salmon', 'tuna']
here ham is a wrong word as its not present in the string. How can I get the list of extract words present in string.