Regex 字符和数字至少出现一次
我希望下面的正则表达式可以匹配字符串“A34CVDREREEVBF98F04389” 但是,我发现正则表达式也可以匹配以下字符串Regex 字符和数字至少出现一次,regex,Regex,我希望下面的正则表达式可以匹配字符串“A34CVDREREEVBF98F04389” 但是,我发现正则表达式也可以匹配以下字符串 000001111122222333334 #The string doesn't include a character. AbstractAlgebraTheory #The string doesn't include a digit. 它是否有办法确保字符和数字在字符串中至少出现一次?使用前瞻 \b(?=.*\d)(?=.*[a-zA-
000001111122222333334
#The string doesn't include a character.
AbstractAlgebraTheory
#The string doesn't include a digit.
它是否有办法确保字符和数字在字符串中至少出现一次?使用前瞻
\b(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z]{21}\b
如有必要,添加锚固件
^(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z]{21}$
^(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z]{21}$