[英]Regex for finding strings that only have lower case alpha numeric but at least one each
I need a regex pattern that will only match if the string has only lower case alphabets and digits, while at least one lower case alphabet and at least one digit has to exist. 我需要一个正则表达式模式,该模式仅在字符串只有小写字母和数字,而必须存在至少一个小写字母和至少一个数字时才匹配。 No other characters like upper case, space, special characters are allowed. 不允许使用其他字符,例如大写,空格,特殊字符。
I currently have ^(?=.*[az])(?=.*[0-9]).+$
which I got from: RegEx to make sure that the string contains at least one lower case char, upper case char, digit and symbol 我目前有^(?=.*[az])(?=.*[0-9]).+$
,它来自: RegEx以确保该字符串至少包含一个小写char,大写char ,数字和符号
However, this seems to still accept strings that have other characters. 但是,这似乎仍然接受具有其他字符的字符串。 How do I achieve it? 我该如何实现?
^(?=.*[a-z])(?=.*[0-9])[a-z0-9]+$
^^^^^^^^
You need to change the string to be accepted. 您需要更改要接受的字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.