我的 phone 号码验证工作不正常

my phone number validation is not working properly

我的 phone 号码验证不工作 properly.it 总是显示错误。我不明白这是什么问题。控制台中没有错误显示。我使用正则表达式 = / ^(?:+?88)?01[13-9]\d{8}$ / ;。孟加拉国。

const number = document.getElementById('number');
    form.addEventListener('submit', (event) => {
         event.preventDefault();
         validate()
    })
    const sedData = (sRate, count) => {
         if (sRate === count) {
          alert("Registration successful");
          swal(`Welcome! ${username} registration successful`);
       }
     }
    const SuccessMsg = (usernameVal) => {
        let formCon = document.getElementsByClassName('form-control');
        var count = formCon.length - 1;
        for (var i = 0; i < formCon.length; i++) {
          if (formCon[i].className === "form-control success") {
          var sRate = 0 + I;
         sedData(usernameVal, sRate, count);
         } else {
           return false;
        }
     }
  }

   const validate = () => {
     const numberVal = number.value.trim();
            if (numberVal === "") {
              setErrorMsg(number, "number can not be blank");
            } else if (numberVal.match(regex)) {
               setSuccessMsg();
            } else {
               setErrorMsg(number, "Oops! your phone number is invalid");
         }
       }
    function setErrorMsg(input, errorMsgs) {
      const formControl = input.parentElement;
      const small = formControl.querySelector('small');
      formControl.className = "form-control error";
      small.innerText = errorMsgs;
  }
 function setSuccessMsg(input) {
   const formControl = input.parentElement;
   formControl.className = "form-control success";
 }

我想这就是您想要的正则表达式 /^(?:\+?88)?01[13-9]\d{8}$/

如有不对的地方,请传一些正反两方面的例子

此外,您在 var sRate = 0 + I; 中的 SuccessMsg 中使用大写字母 I 可以吗?