[英]Password must contain any one of the following criteria
Password must contain any one of the following criteria密码必须包含以下任一条件
1)One Uppercase 2)one lower case 3)one Number 4)one special character. 1) 一个大写 2) 一个小写 3) 一个数字 4) 一个特殊字符。
in the above criteria if any three-match then it's allowed to a valid password.在上述标准中,如果有任何三项匹配,则允许使用有效密码。
like below format.像下面的格式。
1) One number, one lower case alphabet, one uppercase alphabet ---> valid password 1) 一个数字,一个小写字母,一个大写字母--->有效密码
or或者
2)one number, one lower case alphabet, and one special character ---> valid password 2)一个数字,一个小写字母,一个特殊字符--->有效密码
or或者
3)one number, one uppercase alphabet, and one special character ---> valid password. 3)一个数字,一个大写字母,一个特殊字符--->有效密码。
Please help me how to write the regular expression for the above criteria.请帮助我如何编写上述标准的正则表达式。
my requirement is any three combinations one number, one alphabet, one special character.我的要求是任意三种组合,一个数字,一个字母,一个特殊字符。 it's like permutation combination format.这就像排列组合格式。 if I write /(?=. \\d)(?=. [az])(?=. [AZ])(?=. [-._@^]).{8,16}/ format I need to verify so many conditions .so any another way.如果我写/(?= \\ d)(?=。[AZ])(?=。[AZ])(?=。[-._@^])。{8,16} /格式我需要验证这么多条件。所以任何其他方式。
Thanks in advance.提前致谢。
Assuming your special characters are [\\^$.|?*+()假设您的特殊字符是 [\\^$.|?*+()
1) One number, one lower case alphabet, one uppercase alphabet ---> valid password 1) 一个数字,一个小写字母,一个大写字母--->有效密码
[0-9][a-z][A-Z]
or或者
2) one number, one lower case alphabet, and one special character ---> valid password 2)一个数字,一个小写字母,一个特殊字符--->有效密码
[0-9][a-z][\[\\\^\$\.\|\?\*\+\(\)]
or或者
3) one number, one uppercase alphabet, and one special character ---> valid password. 3)一个数字,一个大写字母,一个特殊字符--->有效密码。
[0-9][A-Z][\[\\\^\$\.\|\?\*\+\(\)]
Combine them with OR (|)将它们与 OR (|) 组合
[0-9][a-z][A-Z]|[0-9][a-z][\[\\\^\$\.\|\?\*\+\(\)]|[0-9][A-Z][\[\\\^\$\.\|\?\*\+\(\)]
If the order of the pswd chars is not important so:如果 pswd 字符的顺序不重要,那么:
\\d[az][AZ]
一个数字,一个小写字母,一个大写字母 ---> 有效密码: \\d[az][AZ]
\\d[az][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]
一个数字、一个小写字母和一个特殊字符 ---> 有效密码: \\d[az][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]
\\d[AZ][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]
一个数字,一个大写字母,一个特殊字符--->有效密码: \\d[AZ][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]
So if it's combined in one regex: (\\d[az][AZ])|(\\d[az][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)])|(\\d[AZ][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)])
因此,如果它组合在一个正则表达式中: (\\d[az][AZ])|(\\d[az][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)])|(\\d[AZ][\\[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.