正则验证(value表示验证的内容)

   1、 自定义邮箱规则

      const regEmail = /^\w+@\w+(\.\w+)+$/

     regEmail.test(value)为true合法,否则不合法

  2、自定义手机号规则

      const regMobile = /^1[34578]\d{9}$/

     regMobile.test(value)为true合法,否则不合法

猜你喜欢

转载自blog.csdn.net/weixin_39418338/article/details/106064887