jkushwaha commited on
Commit
1b941f7
·
verified ·
1 Parent(s): a458e17

Update MSI_High_matching.py

Browse files
Files changed (1) hide show
  1. MSI_High_matching.py +17 -0
MSI_High_matching.py CHANGED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ keys = ['apple', 'banana', 'orange']
4
+ words = ['i like apples', 'i have a banana', 'oranges are tasty']
5
+
6
+ # Create regex pattern
7
+ pattern = r'\b(?:' + '|'.join(keys) + r')\b'
8
+
9
+ # Compile regex pattern
10
+ regex = re.compile(pattern)
11
+
12
+ # Check for matches
13
+ for word in words:
14
+ if regex.search(word.lower()):
15
+ print(f"At least one key found in '{word}'")
16
+ else:
17
+ print(f"No keys found in '{word}'")