Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex search a words among list

# credit to the Stack Overflow user in the source link

import re
string_list = ['fun', 'dum', 'sun', 'gum']
s = "I love to have fun."

re.findall(r"(?=("+'|'.join(string_list)+r"))", s)
>>> ['fun']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #regex #search #words #list
ADD COMMENT
Topic
Name
2+3 =