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…
Archived: 3 Comments
hoxide | January 10, 2006 10:32 AM
确实如此, re的算法没优化? maybe
xyb | January 10, 2006 11:43 AM
这是一个老毛病了吧,早就有人在python列表上提过了,不过不知道为什么还没有搞定。
makiyo | January 11, 2006 12:02 AM
看不认识的人在讨论完全听不懂的话……感觉……像银河漫游指南。上了这个博,就像到了……外星球。^&^