Java we will often use a number of judgments such as IP, e-mail, telephone number is not in line with, then we how to judge it, the answer is to use regular expression to judge, because I do not have too deep research on the regular expression, all interested friends can own Baidu. I will give the basic judgment, the nonsense is not much to say, the following is the code.How to determine IP addresspublic st
} $) | (^ 0 {0, 1} 13 [0-9] {9} $)Return: If the verification succeeds, true is returned; otherwise, false is returned.
The Code is as follows:
Copy code
Function istel (s ){Var str = s;Var reg =/(^ [0-9] {3, 4}-[0-9] {3, 8} $) | (^ [0-9] {3, 8} $) | (^ ([0-9] {3, 4}) [0-9] {3, 8} $) | (^ 0 {0, 1} 13 [0-9] {9} $ )/;If (reg. test (str )){Return true;} Else {Return false;}}
When I manually tested it, I found that something like 153,152,187,188 could not pass, and the
The simplest and most practical regular expression for php mobile phone numbers. For more information, see. mobile: 134, 135, 136, 137, 138, 139, 150, 151, 157 (TD), 158, 159, 187, 188 Unicom: 130... the simplest and most practical regular expression for php mobile phone numbers. For more information, see.
Mobile: 134, 135, 136, 137, 138, 139, 150, 151, 157 (TD), 158, 159, 187, 188
China Unicom: 130, 131,
Everyone should have this common sense, China's mobile phone number is the number "1", and then use the "0~9" 10 digits of the 11-digit combination, then our validation rules must be based on this idea to write.Based on the above simple idea, we can write down the following verification code, the code is as follows:
The positive of the cell phone number verification is:
The code is as follows
Copy Code
var reg =/^0{0,1} (13[0-9]|15[7-9]|153|156|18[7-9]) [0-9]{8}$/;var reg =/^0{0,1} (13[0-9]|15[0-9]) [0-9]{8}$/;
There is also a way of writing
The code is as follows
Copy Code
var regex = {Mobile:/^0? (13[0-9]|
Phone number Regular expression (support mobile phone number, 3-4-digit area code, 7-8-digit live number, 1-4 non-transposition machine number)
The code is as follows
Copy Code
((d{11}) |^ ((d{7,8}) |
Common Regular matching expressions
Regular expression--verification of mobile phone number: 13[0-9]{9}
To achieve the mobile phone number 86 or +86 before: ^ (\+86) | (86))? (\d{9}$)
The phone number and mobile
("Please enter the correct cell phone number!") ");
$ ("#varMobilePhone"). focus ();
Return }
}
Mobile Number Verification Information
function Ismobil (s)
{
var patrn =/(^0{0,1}1[3|4|5|6|7|8| 9][0-9]{9}$)/;
if (!patrn.exec (s))
{
return false;
return true; }
Background validation is as follows:
if (model
correct cell phone number!") ");
$ ("#varMobilePhone"). focus ();
Return }
}
Mobile Number Verification Information
function Ismobil (s)
{
var patrn =/(^0{0,1}1[3|4|5|6|7|8| 9][0-9]{9}$)/;
if (!patrn.exec (s))
{
return false;
return true; }
Background validation is as follows:
if (model. Zip!= null)
{
i
Everyone should have this common sense, China's mobile phone numbers are based on the number "1" Start, and then use "0~9" 10 numbers composed of 11-digit combination, then our validation rules must be based on this idea to write.Based on the simple idea above, we can write down the following verification code, the code is as follows:PHP//This code is just to pro
Requirements: One, mobile phone number is 11 or 12 digits, if 12 digits, then the first digit is 0The first and second digits of the 11-digit mobile phone number are "13"The second and third digits of the 12-digit mobile phone number
expression that matches the current phone number validation.
var reg =/^1[3|4|5|7|8][0-9]{9}$/; Validation Rule
var phonenum = ' 15507621999 '//Mobile number
var flag = reg.test (phonenum);//true
But have you ever thought that maybe this second code might add one at a ti
Because we usually use the beep of a taxi is on the micro-letter landing, if you want to change the tick-tock phone-bound mobile number, we need to modify the micro-letter binding mobile phone number. Then you can change your phone numbe
network) has 134x (0-8), 135, 136, 137, 138, 139, 150, 151, 152, 158, 159, 182, 183, 184.Segment 3G (TD-SCDMA Network) 157, 187, 1883G Internet Card 147Section 4G, 178From the above we can see that the first is the beginning of "1", the second is "3,4,5,7,8", the third is "0-9", the third is the number "0-9". So we can draw a regular expression that matches the current cell phone
Verifying the phone number regular expressionNow the number is too much, everything has, then relax the requirements of the BaiA combination of 11-digit numbers starting with 1 /** * Verify mobile phone number * @param phonenumber Mobile
Mobile (China Mobile phone number):
The code is as follows
Copy Code
regexp= "^ ((d{3}) | ( d{3}-))? 13[456789]d{8}|15[89]d{8} "
Verify if the phone number is a regular
The code is as follows
Copy Code
: "^ (13[0-9]|15[0|3|6|7|8| 9]|18[6|8| 9]) d{8}$ "
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.