简体   繁体   English

正则表达式,用于查找仅包含小写字母数字但每个字符至少一个的字符串

[英]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.

相关问题 需要一个正则表达式来表示字母数字小写和 . 和 _ - Need a regex for alpha numeric lower case and . and _ 字母数字小写字母和“-”, - Alpha numeric lower case case and “-” , 正则表达式接受至少一个字母字符和数字字符 - Regex to accept at least one alpha char and numeric char 仅使用正则表达式,如果同一单词至少出现一次,则如何将单词的大小写从单词的第一个字母改为第一个字母 - How to change case from upper to lower of a words 1st letter if the same word occures at least one time in lower case using regex only RegEx 确保字符串至少包含一个小写字符、大写字符、数字和符号 - RegEx to make sure that the string contains at least one lower case char, upper case char, digit and symbol 必须至少有 3 个字母字符的正则表达式 - RegEx that must have at least 3 alpha characters 至少有一个 1 和偶数个 0 的二进制字符串的正则表达式 - Regex of binary strings that have at least one 1 and an even number of 0 只有alpha和只有数字正则表达式问题 - only alpha and only numeric regex issue .NET RegEx可以验证6到20个字符之间的密码,并至少包含一个大写字母,一个小写字母和一位数字 - .NET RegEx to validate password between 6 and 20 characters with at least one upper case letter, one lower case letter and one digit 在现有的正则表达式(javascript)上添加“任意位置的至少一个字母,大写或小写” - Add 'at least one letter, upper or lower case at any position' to existing regex (javascript)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM