screamo

手机号,固定电话,邮箱正则表达式验证

手机号:1开头,34578第二位,\d9位,共11位

checkPhone: function (phone) {
  let re =  /^1(3|4|5|7|8)\d{9}$/
  return re.test(phone)
}

固定电话:区号加号码

checkTelePhone: function (phone) {
  const re = /^0\d{2,3}-?\d{7,8}$/
  return re.test(phone)
}

邮箱:@前,@后\.前,\.后,1到2个后缀

checkEmail: function (str) {
  const re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,}){1,2}$/
  return re.test(str)
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2021-11-21
  • 2021-12-25
  • 2021-11-29
  • 2021-11-29
  • 2021-11-29
猜你喜欢
  • 2021-12-31
  • 2021-12-06
  • 2021-11-07
  • 2021-11-29
  • 2022-01-02
相关资源
相似解决方案