js 验证手机号正则

一、验证手机号正则

   /* *
    * 移动号码包括的号段:134/135/136/137,138,139;
    *                     147/148(物联卡号);
    *                     150/151/152/157/158/159;
    *                     165(虚拟运营商);
    *                     1703/1705/1706(虚拟运营商)、178;
    *                     182/183/184/187/188
    *                     198

    * 联通号段包括:130/131
    *               145
    *               155/156
    *               166/167(虚拟运营商)
    *               1704/1707/1708/1709、171
    *               186/186
    *
    * 电信号段包括: 133
    *                153
    *                162(虚拟运营商)
    *                1700/1701/1702(虚拟运营商)
    *                180/181/189
    *                191/199
    * */
let reg = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
        if (!reg.test(this.phone) || !this.phone.length==11) {
          console.log("输入的手机号不正确")
        }else{
          console.log("正确")
        }

 

你可能感兴趣的:(web,前端,js)