Is there a regexp that can't match any string that you throw at it, including the empty string?
(no, this isn't an attempt at
nerd sniping, this is for tests).
Use a negative lookahead to make sure something isn't there... and then check if that thing is actually there? That way, it's impossible for the check to ever match.
>>> import re
>>> regex = re.compile(r"^(?!spam)spam")
>>> regex.match("")
>>> regex.match("spam")
>>> regex.match("eggs")
>>> regex.match("s")
>>> regex.match("m")
>>> regex.match("pam")
Start-of-line character included so the regex engine doesn't scan the entire line. If it matters :p