filter正则 筛选 手机号

130 阅读1分钟
  let hasPhone = res.filter((item) => {
          // item.contactPhone !== null && item.contactPhone !== undefined && item.contactPhone == 'undefined'
          let reg = new RegExp(/^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\d{8}$/);
          if(reg.test(item.contactPhone)){count++}
       return reg.test(item.contactPhone);
        
        })