Python: list and string matching
Posted
by pete
on Stack Overflow
See other posts from Stack Overflow
or by pete
Published on 2010-04-23T07:26:06Z
Indexed on
2010/04/23
7:33 UTC
Read the original article
Hit count: 286
Hi All,
I have following:
temp = "aaaab123xyz@+"
lists = ["abc", "123.35", "xyz", "AND+"]
for list in lists
if re.match(list, temp, re.I):
print "The %s is within %s." % (list,temp)
The re.match is only match the beginning of the string, How to I match substring in between too.
© Stack Overflow or respective owner