When passing an empty string to a regular expression object, the result of a search is a match object an not None. Should it be None since there is nothing to match?
import re
m = re.search("", "some text")
if m is None:
print "Returned None"
else:
print "Return a match"
Incidentally, using the special symbols ^
and $
yield the same result.