delphij's Chaos

选择chaos这个词是因为~~实在很难找到一个更合适的词来形容这儿了……

10 Jan 2006

Bug in Python re implementation?

Python includes a Regular Expression implementation, called re. However, I thought that I have hit a bug.

The following regular expression is apparantly wrong, but Python spend much CPU time to give a mismatch:

_mailcheck = re.compile("^(\w|.){3,25}$")
_mailcheck.match(“foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo”)

I think the “.” would override anything (including “\w”), but this does not happen…