different behavior when using re.finditer and re.match.
- by Shahzad
Hi, I'm working on a regex to to collect some values from a page through some script. I'm using re.match in condition but it returns false but if i use finditer it returns true and body of condition is executed. i tested that regex in my own built tester and it's working there but not in script.
here is sample script.
result = []
RE_Add0 = re.compile("\d{5}(?:(?:-| |)\d{4})?", re.IGNORECASE)
each = ''Expiration Date:\n05/31/1996\nBusiness Address: 23901 CALABASAS ROAD #2000 CALABASAS, CA 91302\n'
if RE_Add0.match(each):
result0 = RE_Add0.match(each).group(0)
print result0
if len(result0) < 100:
result.append(result0)
else:
print 'Address ignore'
else:
None