如何验证包含.......的密码 [英] How to verify a password which contain .......
问题描述
大家好,
我有一个包含密码字段的注册页面.但是我希望密码字段必须包含以下所有以下内容:
Hi all,
I have a registration page which contains a password field.But i want the password field must contains all the following below as
1)lower case letter
2)one upper case letter
3)special character
4)one number
谢谢
Thanks
推荐答案
为什么?您没有阅读此 [ ^ ]?
无论如何, RegEx [
Why? Haven''t you read this[^]?
Anyway, RegEx[^] will do.
像Firo所说的Regex可以为您做到这一点,我为您拼凑了一个
Like Firo said Regex can do that for you, I''ve put one together for you
(?=^.{8})(?=.*[a-z])(?=.*[A-Z])(?=.*[^\w\d])(?=.*\d).*
如果您要使用Google,可以找到更多的信息.
但是,除了您发布的4个要点以外,强密码还具有更多功能.
1)长度(我给您的正则表达式中包括;最小长度8)
2)顺序字母/数字(例如abc,12345),这会使密码的强度降低
3)不区分大小写的重复字符(例如XxXXxx),这会使密码强度降低
4)此处的列表在继续,其含义是使密码或多或少地具有强度.我不会在这里输入所有内容,因为我相信您拥有想要的信息.
You can find plenty more if you Google for it.
There is however more to a strong password than the 4 points you posted.
1) Length (included in the regex a I gave you; min. length 8)
2) Sequential letters/digits (e.g. abc, 12345) this makes the password less strong
3) Case insensitive repeated characters (e.g. XxXXxx) this makes the password less strong
4) The list here goes on, with what makes a password more or less strong. I wont type it all out here though as I believe you have the info you want.
这篇关于如何验证包含.......的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!