Lets say I have a list of strings,
string_lst = [\'fun\', \'dum\', \'sun\', \'gum\']
I want to make a regular expression, where at a point
string_lst = ['fun', 'dum', 'sun', 'gum']
x="I love to have fun."
print re.findall(r"(?=("+'|'.join(string_lst)+r"))",x)
You cannot use match as it will match from start.Use findall instead.
Output:['fun']
using search you will get only the first match.So use findall instead.
Also use lookahead if you have overlapping matches not starting at the same point.