必须包含四种的组合密码

 var passwordreg = /(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/
 var isValid = passwordreg.test(this.user.newPassword);
 if(isValid != true){
     this.msgError("密码必须是大写字母,小写字母,数字,特殊字符组成,且长度为8到12位!");
     return;
}

必须包含四种中三种的组合校验

 var passwordreg = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,30}$/

必须包含大小写字母、数字、特殊字符长度再8-16位之间

let password = this.password
let reg = !/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[\W_]).{8,16}/

if(reg.test(password)){
//表单展示内容
}else{
//表单展示内容
}

 

Logo

前往低代码交流专区

更多推荐