Regular expressions for mobile phone numbers and phone numbers

Source: Internet
Author: User

Not all tests are reproduced for future reference.

Original: http://www.cnblogs.com/xyzhuzhou/archive/2012/05/08/2490388.html

Phone number Regular expression (support mobile phone number,3-4-bit area code,7-8-digit live number,1-4-digit extension) ((\d{ One}) |^ ((\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})) $) match format: 11-digit mobile phone number3-4-bit area code,7-8-digit live number,1-4-digit extension number such as:12345678901、1234-12345678-1234        "^\d+$"    //non-negative integers (positive integers + 0)"^[0-9]*[1-9][0-9]*$"    //positive integers"^ ((-\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 + 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 pointnumber"^ (-?\d+) (\.\d+)? $"    //floating point number"^[a-za-z]+$"   //A string consisting of 26 English letters"^[a-z]+$"    //A string consisting of 26 uppercase letters in English"^[a-z]+$"    //A string of 26 English letters in lowercase"^[a-za-z0-9]+$"    //A string consisting of a number and 26 English letters"^\w+$"    //A string consisting of numbers, 26 letters, or underscores"^[\w-]+ (\.[ \w-]+) *@[\w-]+ (\.[ \w-]+) +$"      //Email Address"^[a-za-z]+://(\w+ (-\w+) *) (\. ( \w+ (-\w+) *) * (\?\s*)? $"    //URL/^ -\d{9}$/GI mobile phone number Regular expression Public Static BOOLIsvalidmobileno (stringMobileno) {    Const stringRegpattern =@"^ (130|131|132|133|134|135|136|137|138|139) \d{8}$"; returnRegex.IsMatch (Mobileno, Regpattern); } Regular Expressions--Verify your phone number:1[3|5|7|8|] [0-9]{9} Implement the phone number 86 or+86 of the situation: ^ (\+ the)| ( the))? ( -) \d{9}$ telephone number and mobile phone number simultaneously verify: (^ (\d{3,4}-)? \d{7,8})$| ( -[0-9]{9}) Extract the network link from the information: (H| H) (r| R) (e| E) (f| F) *= * ('|")? (\w|\\|\/|\.) +('|"|   *|>)? Message address in Extract 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+) \. (\d+) \. (\d+) The Chinese mobile phone number in the extracted information: ( the)*0* -\d{9The Chinese fixed phone number in the extracted information: (\ (\d{3,4}\) |\d{3,4}-|\s)? \d{8the Chinese phone number in the extract information (including mobile and landline):(\ (\d{3,4}\) |\d{3,4}-|\s)? \d{7, -Extract the information in China postcode: [1-9]{1} (\d+) {5the Chinese identity card number in the extracted information: \d{ -}|\d{ theextract the Integer in the information: \d+extract floating-point numbers (that is, decimals) in information: (-?\d*) \.? \d+extract any number from the information: (-?\d*) (\.\d+)?extract the Chinese string from the message: [\u4e00-\u9fa5]*extract the Double-byte string in the message (Kanji): [^\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.