【发布时间】:2013-03-04 01:14:37
【问题描述】:
我试图在用户输入的字符串中查找重复超过 2 次的字符。我有这个,但它没有进入 if 语句。
password = asDFwe23df333
s = re.compile('((\w)\2{2,})')
m = s.search(password)
if m:
print ("Password cannot contain 3 or more of the same characters in a row\n")
sys.exit(0)
【问题讨论】:
标签: regex python-3.x