Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

re.match versus re.findall

Tags:

Why is it, re.match returns the None object whilst a similar re.findall returns a non-empty result?

I'm parsing email subjects. The one in question is

subject = "=?UTF-8?B?0JLQsNGI0LUg0YHQvtC+0LHRidC10L3QuNC1INC90LUg0LTQvtGB0YLQsNCy0LvQtdC90L4=?=. Mail failure."

I'm wondering why

re.match("mail failure", subject, re.I) returns the None object whist the counterpart

re.findall("mail failure", subject, re.I) returns the matched string in a list ['Mail failure']

What is wrong in my thoughts?