SoFunction
Updated on 2025-03-02

Regular expressions in JavaScript and regularity for verifying qq numbers

I won’t say much nonsense, I will just post regular expression code to you.

 function myValid() {
   var errorMsg = "";
   var res = true;
   //Get the value to be verified.   var receiveName = $("#receiveName").val();//Name var receiveMobile = $("#tMobile").val();//Mobile phone number var validCode = $("#validCode").val();//Verification code var regName = /^[\ue-\ufa]{,}$/;//Verification name   var regMobile = /^[||||][-]\d{}$/;//Verify the phone   var regCode = /^\d{}$/;//Verification code   if (!(receiveName)) {
   errorMsg += "The name format is incorrect;\n\r";
   res = false;
   }
   if (!(receiveMobile)) {
   errorMsg += "The mobile phone number is incorrect;\n\r";
   res = false;
   }
   if (!(validCode)) {
   errorMsg += "Please enter the digital verification code of the bit;\n\r";
   res = false;
   }
   if (!res) {
   $.(errorMsg, "Error prompt");
   }
   return res;
 }

Below is a very simple regular expression to verify QQ numbers.

The code is as follows:

[1-9][0-9]{4,}