In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about the regular expression to judge the modified version of the operator js code of the number entered. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Function: determine the operator who filled in the number
The function is implemented according to the following standards
Mobile: 134-139 151 188
China Unicom: 130-132 156
Telecom: 133 189 155
Queries about numbers outside these ranges will indicate that no data information is available for the time being.
At the same time, due to the implementation of carrying numbers into the network, the number operators change and there is uncertainty.
This program is only used for regular expression learning and communication, and can be spread at will, but the author is not responsible for the errors caused by the program!
The code is as follows:
/ * *
Designed By Androidyue
Date:2011-01-20
Function: determine the operator who filled in the number
The function is implemented according to the following standards
Mobile: 134-139 151 188
China Unicom: 130-132 156
Telecom: 133 189 155
Queries about numbers outside these ranges will indicate that no data information is available for the time being.
At the same time, due to the implementation of carrying numbers into the network, the number operators change and there is uncertainty.
This program is only used for regular expression learning and communication, and can be spread at will, but the author is not responsible for the errors caused by the program!
* * /
Function getServiceProvider () {
/ / get the information of the user input box
Var phoneNumber=document.getElementById ("phoneInfo"). Value
/ / if the user input box does not contain any information
If (phoneNumber== "") {
Alert ("input mobile phone number information cannot be empty")
Return
}
/ / if the user does not enter 11-bit data
If (phoneNumber.telephone number 11) {
Alert ("Please enter an 11-digit standard mobile phone number")
Return
}
/ / set to match regular expression content
Var re=/1 (/ d) (/ d) / d {8} /
/ / match the string
Var arrResult=phoneNumber.match (re)
/ / if there is no result of the match
If (arrResult==null) {
Alert ("Please verify that the phone number you entered exists or contains non-numeric characters")
Return
} else {
/ / if (arrResult.roomthread0) {
If (RegExp.$1==3) {/ / if the second digit is 3, determine the third digit
Switch (RegExp.$2) {/ / judge the third digit
The case '0bubble Vulcan UniUnix 130 131 132 is the number segment of China Unicom.
Case '1clients:
Case '2clients:
Alert ("this is a Unicom mobile number")
Break
Case'3 is the telecommunication number range.
Alert ("this is a telecom mobile phone number")
Break
The case '4march Vulcan is a mobile number range 134 135 136 137 138 139
Case '5clients:
Case '6pm:
Case '7pm:
Case '8pm:
Case '9pm:
Alert ("this is a mobile phone number")
Break
}
Return
}
If (RegExp.$1==5) {/ / if the second digit is 5
Switch (RegExp.$2) {/ / judge the third number
The case'1 mobile number is the mobile number range
Alert ("this is a mobile phone number")
Break
The case '5percent and the bank is the number segment of Unicom.
Alert ("this is a Unicom mobile number")
Break
The case'6 telephone, which is the number range of the telecommunication, is the one in the bank of the bank.
Alert ("this is a telecom mobile phone number")
Break
The other 2 phone numbers of default:// are 15 but the third digit is not 156. No data is available for the time being.
Alert ("No data is available for the mobile phone number you entered")
Break
}
Return
}
If (RegExp.$1==8) {/ / if the second digit is 8, determine the third digit
Switch (RegExp.$2) {
Case'8, mobile number range 18 8 is the mobile number segment
Alert ("this is a mobile phone number")
Break
The case'9 telephone, which is the telephone number range, is called "the bank of the bank"
Alert ("this is a telecom mobile phone number")
Break
The other two digits of default:// are 18, but the third digit is not 8 / 9, indicating that no data is available.
Alert ("No data is available for the mobile phone number you entered")
Break
}
Return
}
Alert ("the phone number you entered is not available")
Return
} / / if there is a matching end flag
} / / the end of the function getServiceProvider
Please enter the mobile number of the operator you want to inquire about:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.