Geo*_*off 1 regex typescript angular
我想设置验证密码字段包含:
大写字母,小写字母,数字和特殊字符
这是我到目前为止:
passwordValueValidator(control) {
if (control.value != undefined) {
if (!control.value.match(/^(?=.*[0-9])[a-zA-Z0-9!@#$%^&*]{6,100}$/)) {
return { 'invalidPassword': true };
}
else{
//here i need to add check for special characters
}
}
}
Run Code Online (Sandbox Code Playgroud)
以上代码仅适用于字母和数字组合.我还需要添加什么来检查用户是否输入了特殊字符
特殊字符是:( !@#$%^&*()_+按shift +数字0-10输入)