js 手机号和邮箱正则匹配

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhangbinlong/article/details/78666537
if (!email.match(/\w+[@]{1}\w+[.]\w+/)) {
     layui.layer.msg("邮箱格式不正确!", {icon: 2});
 } else if (!phone.match(/^1\d{10}$/)) {
     layui.layer.msg("请输入正确的手机号!", {icon: 2});
 } else if (!password.match(/^[0-9a-zA-Z_#]{6,12}$/)) {
      layui.layer.msg("密码必须6到12位数字字母符号组成!", {icon: 5});
 }

猜你喜欢

转载自blog.csdn.net/zhangbinlong/article/details/78666537