尝试根据以下条件查找模式匹配:
- 字符串长度为 5 个字符
- 字符 [0] = 字母/数字
- 字符 [1] = 字母
- 字符 [2-4] = 数字
我不明白为什么“22222”适用于这个表达式?
p = r'(\w|\d)(\w)(\d){3,}'
m = re.match(p, "AA012") # Works as expected
--> 'AA012'
m = re.match(p, "1A222") # Works as expected
--> '1A222'
m = re.match(p, "22222") # Does NOT work as expected!
--> '22222'
我的正则表达式语法中缺少什么?