Common regular expressions-supplement the regular expression of 1 phone number (mobile phone number, 3-4 area code, 7-8 live video number, 1-4 extension code)

Source: Internet
Author: User
Regular Expression of phone number (mobile phone number, 3-4 area code, 7-8 live video number, 1-4 extension code)

(\ D {11}) | ^ (\ d {7, 8}) | (\ d {4} | \ d {3})-(\ d {7, 8 }) | (\ d {4} | \ d {3})-(\ d {7, 8 }) -(\ d {4} | \ d {3} | \ d {2} | \ d {1}) | (\ d {7, 8 }) -(\ d {4} | \ d {3} | \ d {2} | \ d {1}) $)

Matching format:
11-digit mobile phone number
3-4-bit area code, 7-8 live video numbers, 1-4 ext.
For example: 12345678901, 1234-12345678-1234

 

 

 

"^ \ D + $" // non-negative integer (positive integer + 0)
"^ [0-9] * [1-9] [0-9] * $" // positive integer
"^ (-\ D +) | (0 +) $" // non-positive integer (negative integer + 0)
"^-[0-9] * [1-9] [0-9] * $" // negative integer
"^ -? \ D + $ "// integer
"^ \ D + (\. \ d + )? $ "// Non-negative floating point number (Positive floating point number + 0)
"^ ([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ "// Positive floating point number
"^ (-\ D + (\. \ d + )?) | (0 + (\. 0 + )?)) $ "// Non-Positive floating point number (negative floating point number + 0)
"^ (-([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ "// negative floating point
Quantity
"^ (-? \ D +) (\. \ d + )? $ "// Floating point number
"^ [A-Za-z] + $" // A string consisting of 26 English letters
"^ [A-Z] + $" // a string consisting of 26 uppercase letters
"^ [A-z] + $" // a string consisting of 26 lowercase letters
"^ [A-Za-z0-9] + $" // string consisting of digits and 26 letters
"^ \ W + $" // a string consisting of digits, 26 letters, or underscores
"^ [\ W-] + (\. [\ w-] +) * @ [\ w-] + (\. [\ w-] +) + $ "// email address
"^ [A-zA-z] +: // (\ w + (-\ w + )*)(\. (\ w + (-\ w + )*))*(\? \ S *)? $ "// Url
/^ 13 \ d {9} $/gi mobile phone number Regular Expression
Public static bool isvalidinclueno (string inclueno)
{
Const string regPattern = @ "^ (130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139) \ d {8} $ ";
Return Regex. IsMatch (regioneno, regPattern );
}
Regular Expression -- verify mobile phone number: 13 [0-9] {9}
If the mobile phone number is 86 or + 86 before it is implemented: ^ (\ + 86) | (86 ))? (13) \ d {9} $
Verify the phone number and phone number at the same time: (^ (\ d {3, 4 }-)? \ D {7, 8}) $ | (13 [0-9] {9 })
Extract the network link in the information: (h | H) (r | R) (e | E) (f | F) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Email Address in the extracted information: \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w + )*
Extract the image link in the information: (s | S) (r | R) (c | C) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Extract the IP address in the information: (\ d +) \. (\ d +)
Extract the Chinese mobile phone number from the information: (86) * 0*13 \ d {9}
Extracted Chinese landline numbers from the information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {8}
Extract Chinese phone numbers (including mobile and landline phones) from the Information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {7, 14}
Extracted Chinese zip code: [1-9] {1} (\ d +) {5}
Chinese ID card number in the extracted information: \ d {18} | \ d {15}
Extract the integer \ d + from the information.
Extract floating point numbers (decimal places) in the Information ):(-? \ D *)\.? \ D +
Extract any number from the information :(-? \ D *) (\. \ d + )?
Extract the Chinese string from the information: [\ u4e00-\ u9fa5] *
Double-byte string (Chinese character) in the extracted information: [^ \ x00-\ xff] *

(\ D {11}) | ^ (\ d {7, 8}) | (\ d {4} | \ d {3})-(\ d {7, 8 }) | (\ d {4} | \ d {3})-(\ d {7, 8 }) -(\ d {4} | \ d {3} | \ d {2} | \ d {1}) | (\ d {7, 8 }) -(\ d {4} | \ d {3} | \ d {2} | \ d {1}) $)

Matching format:
11-digit mobile phone number
3-4-bit area code, 7-8 live video numbers, 1-4 ext.
For example: 12345678901, 1234-12345678-1234

 

 

 

"^ \ D + $" // non-negative integer (positive integer + 0)
"^ [0-9] * [1-9] [0-9] * $" // positive integer
"^ (-\ D +) | (0 +) $" // non-positive integer (negative integer + 0)
"^-[0-9] * [1-9] [0-9] * $" // negative integer
"^ -? \ D + $ "// integer
"^ \ D + (\. \ d + )? $ "// Non-negative floating point number (Positive floating point number + 0)
"^ ([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ "// Positive floating point number
"^ (-\ D + (\. \ d + )?) | (0 + (\. 0 + )?)) $ "// Non-Positive floating point number (negative floating point number + 0)
"^ (-([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ "// negative floating point
Quantity
"^ (-? \ D +) (\. \ d + )? $ "// Floating point number
"^ [A-Za-z] + $" // A string consisting of 26 English letters
"^ [A-Z] + $" // a string consisting of 26 uppercase letters
"^ [A-z] + $" // a string consisting of 26 lowercase letters
"^ [A-Za-z0-9] + $" // string consisting of digits and 26 letters
"^ \ W + $" // a string consisting of digits, 26 letters, or underscores
"^ [\ W-] + (\. [\ w-] +) * @ [\ w-] + (\. [\ w-] +) + $ "// email address
"^ [A-zA-z] +: // (\ w + (-\ w + )*)(\. (\ w + (-\ w + )*))*(\? \ S *)? $ "// Url
/^ 13 \ d {9} $/gi mobile phone number Regular Expression
Public static bool isvalidinclueno (string inclueno)
{
Const string regPattern = @ "^ (130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139) \ d {8} $ ";
Return Regex. IsMatch (regioneno, regPattern );
}
Regular Expression -- verify mobile phone number: 13 [0-9] {9}
If the mobile phone number is 86 or + 86 before it is implemented: ^ (\ + 86) | (86 ))? (13) \ d {9} $
Verify the phone number and phone number at the same time: (^ (\ d {3, 4 }-)? \ D {7, 8}) $ | (13 [0-9] {9 })
Extract the network link in the information: (h | H) (r | R) (e | E) (f | F) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Email Address in the extracted information: \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w + )*
Extract the image link in the information: (s | S) (r | R) (c | C) * = * ('| ")? (\ W | \/| \.) + ('| "| * |> )?
Extract the IP address in the information: (\ d +) \. (\ d +)
Extract the Chinese mobile phone number from the information: (86) * 0*13 \ d {9}
Extracted Chinese landline numbers from the information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {8}
Extract Chinese phone numbers (including mobile and landline phones) from the Information: (\ d {3, 4} \) | \ d {3, 4}-| \ s )? \ D {7, 14}
Extracted Chinese zip code: [1-9] {1} (\ d +) {5}
Chinese ID card number in the extracted information: \ d {18} | \ d {15}
Extract the integer \ d + from the information.
Extract floating point numbers (decimal places) in the Information ):(-? \ D *)\.? \ D +
Extract any number from the information :(-? \ D *) (\. \ d + )?
Extract the Chinese string from the information: [\ u4e00-\ u9fa5] *
Double-byte string (Chinese character) in the extracted information: [^ \ x00-\ xff] *

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.