Mobile phone number validation latest regular expression

If you are Xiaobai, this set of information can help you become a big bull. If you have rich development experience, this set of information can help you break through the bottleneck
2022web full set of video tutorial front-end architecture H5 vue node applet Video + data + code + interview questions.

Generally, the form page needs to fill in the mobile phone number. To verify whether the mobile phone number entered by the user is correct, we need to use the regular expression to match the mobile phone number segment. If it is in the operator number segment, the number is correct. Therefore, it is necessary to know the latest segment number of the operator, as shown below:

Mobile phone number segment of major operators (New)

China telecom signal section


China Unicom section


China mobile segment


China Radio and television section


Other segments

Segment 14 is the exclusive segment of the network card: China Unicom 145, China Mobile 147, China Telecom 149

Virtual operators:

Telecommunications: 1700, 1701, 1702, 162
Mobile: 1703, 1705, 1706, 165
Unicom: 1704, 1707, 1708, 1709, 171, 167
Satellite communication: 1349, 174
Internet of things: 140, 141, 144, 146, 148

It can be seen from the above paragraph that the mobile phone number starts with 1, the second digit is any one of 3456789, and the third digit is either 0-9 in the whole paragraph or only part, as follows:

Cell phone numbers beginning with 13 and 18 are full paragraphs

The mobile phone number at the beginning of 13 is the whole paragraph: 13 [0123456789], such as 130131132... 139
The mobile phone number beginning with 18 is the whole paragraph: 18 [0123456789], such as 180181182... 189

The mobile phone numbers beginning with 15 and 19 are followed by all but 4, without 154 and 194

15 [012356789] for example, 150151152153155... 159
19 [012356789] for example, 190191192193195... 159

The mobile phone number beginning with 17 is followed by 9

17 [01235678] for example, 170171172173... 178

There are all mobile phone numbers starting with 14 Except 2 and 3, without 142 and 143

14 [01456879] for example, 140141144145... 149

The mobile phone number starting with 16 is followed by 2567

16 [2567] for example: 162165166167

After knowing the latest number segment of the operator, write the latest regular expression for mobile phone number verification:


Examples in javascript:

	var reg_user = /^[one-A]{2,4}$/;    //2-4 Chinese characters regular
	var reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])d{8}$/;    //11 digit mobile phone number
	function checkSubmit() {
		if (document.form.user.value =="") {
			alert("Name cannot be empty!");
			return false;
		} else if (!reg_user.test(document.form.user.value)) {
			alert("Name can only be 2-4 chinese!");
			return false;
		if ( =="") {
			alert("Please fill in your mobile phone number!");;;
			return false;
		} else if (!reg_tel.test( {
			alert("Please fill in your mobile phone number correctly!");;;
			return false;

Because mobile phone numbers start with 1, you can also write this:


This is to write all the operator segments together, including virtual operators and the Internet of things. You can also write them according to the needs of the project.

Common regular expressions for form field validation

1. Name

/^[one-A]{2,4}$/    //2-4 Chinese characters regular

2. Mobile phone number


3. Landline number


4. Email address


5, ID number
(1) General verification


(2) Accurate calibration
18 bits


15 bits


Last 6 digits


6. QQ number


7. Postal code


8. Registered account


Keywords: Front-end html Back-end Interview regex

Added by nate2687 on Sun, 20 Feb 2022 22:53:34 +0200