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}'")