JS正则表达式验证密码格式的集中情况总结
程序员文章站
2023-11-27 22:42:52
1.密码必须为6-18位字母、数字、特殊符号的:
var reg =/^(?=.*[a-za-z])(?=.*\d)(?=.*...
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,}$/
以上所述是小编给大家介绍的js正则表达式验证密码格式的集中情况总结,希望对大家有所帮助