File size: 460 Bytes
1b941f7 85e39b4 1b941f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import re
keys = ['dmmr', 'deficient mismatch repair', 'hypermutation','lynch syndrome']
words = ['i like apples', 'i have a banana', 'oranges are tasty']
# Create regex pattern
pattern = r'\b(?:' + '|'.join(keys) + r')\b'
# Compile regex pattern
regex = re.compile(pattern)
# Check for matches
for word in words:
if regex.search(word.lower()):
print(f"At least one key found in '{word}'")
else:
print(f"No keys found in '{word}'")
|