密码字段验证 [英] password field validation

查看:81
本文介绍了密码字段验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


任何人请告诉我如何在以下条件下验证密码字段

密码必须包含至少6个字符和至少1个大写字母,至少1个小写字母和至少1个数字.

感谢

解决方案

浏览-
http://blog.stevenlevithan.com/archives/javascript-password-validator [ ^ ]
http://javascriptsource.com/forms/val-pass.html [ http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C4F005D3717 [ ^ ]


似乎很直接的东西供您编写.如果您是我,我会先验证长度-不过请继续进行验证,因为您应该将所有问题报告给用户.然后,您可以使用三个简单的正则表达式查看是否有任何匹配项(其他条件中的每一个都匹配).


长度 [ ^ ]属性

D Anil Kumar写道:

并至少使用一个大写字母,至少一个小写字母和至少一个数字

使用 解决方案

Go through -
http://blog.stevenlevithan.com/archives/javascript-password-validator[^]
http://javascriptsource.com/forms/val-pass.html[^]
http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C4F005D3717[^]


Seems a pretty straight forward thing for you to write. If I were you, I''d start by validating the length - keep going with the validation though, as you should report all the problems to the user. Then you can use three simple regular expressions to see if you have any matches (one for each of the other conditions).


D Anil Kumar wrote:

password must contain atleast 6 characters

Use length[^] property

D Anil Kumar wrote:

and atleast one Capital letter and atleast one small letter and atleast one number

Use Regular expressions[^]


这篇关于密码字段验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆