!/.../中间为表达式
姓名正则:
if (!/^([\u4e00-\u9fa5]{2,20}|[a-zA-Z.\s]{2,20})$/.test(this.form.adminName)) {
error = "姓名长度必须为2-20个字符\n";
}
手机号正则:
if(!/^1[0-9]{10}$/.test(this.form.adminTel)){
error = "请输入十一位手机号\n";
this.form.adminTel=""
}
用户名正则:
if (!/^[a-zA-Z0-9_-]{4,16}$/.test(this.form.loginName)) {
error = "请输入4到16位(字母,数字,下划线,减号)用户名\n";
this.form.loginName = ""
}
密码正则:
if (!/^[a-zA-Z0-9-*/+.~!@#$%^&*()]{6,}$/.test(this.form.loginPass)) {
error = "请输入至少六位字符的密码可包含(-*/+.~!@#$%^&*())\n";
this.form.loginPass = ""
this.confirmPass = ""
}