JS正则表达式验证密码格式的集中情况总结
1.密码必须为6-18位字母、数字、特殊符号的:
var reg =/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{6,18}$/;
2.密码必须为6-18位字母、数字
var reg=/^(?![^a-zA-Z]+$)(?!\D+$)/
3.支持字母、数字、标点符号、特殊字符
var reg=/^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9])).{6,}|(?:(?=.*[A-Z])(?=.*[a-z])|(?=.*[A-Z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])|(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[0-9])(?=.*[^A-Za-z0-9])|).{6,}$/
相关推荐
山水沐光 2020-05-26
peterwzc 2020-03-17
lidengfengboke 2017-02-22
niuyongaiai 2011-10-28
不要皱眉 2016-09-26
qianhaohong 2015-10-11
守love唯诺 2013-10-01
yoyoshadow 2013-06-03
gongg0 2013-01-21
samulelin 2012-10-27
李湘华 2012-10-11
人生若只如初见 2012-05-10