2013-08-07 23:18:39|
import re rule = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]{0,18}[a-zA-Z0-9]$') # 将正则表达式编译成Pattern对象 str_match = rule.match(username) if str_match: print True