的正则表达式字母数字密码,至少1个数字和字符 [英] Regex for alphanumeric password, with at least 1 number and character
问题描述
需要与字母数字密码正则表达式的帮助,至少有1号和字符,长度必须在8-20个字符之间。
我有这个,但似乎并不奏效(它没有长度要求其一):
^ [A-ZA-z0- 9] * [A-ZA-Z] [A-ZA-Z0-9] * $
如果你看看这个 MSDN链接,它提供了密码验证的正则表达式表达的一个例子,和(更具体地说)如何在ASP.NET中使用它。
有关你要找来完成,这算什么应工作:(?!^ [0-9] * $)?!
(^ [A-ZA-Z] * $)^([A-ZA-Z0-9] {8,20})$
这至少需要一个数字,至少一个字母字符,没有特殊的字符,并从8-20个字符的长度。
Need help with a regex for alphanumeric password, with at least 1 number and character, and the length must be between 8-20 characters.
I have this but doesn't seem to be working (it doesn't have length requirements either):
^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$
If you take a look at this MSDN link, it gives an example of a password validation RegEx expression, and (more specifically) how to use it in ASP.NET.
For what you're looking to accomplish, this should work:
(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,20})$
This requires at least one digit, at least one alphabetic character, no special characters, and from 8-20 characters in length.
这篇关于的正则表达式字母数字密码,至少1个数字和字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!