Regular Expression (1)

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-digit area code, 7-8-bit live video number, 1-4 extension numbers such as: 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 number" ^ (-? \ D +) (\. \ d + )? $ "// Floating point number" ^ [A-Za-z] + $ "// A string consisting of 26 English letters" ^ [A-Z] + $ "// consists of 26 a string consisting of uppercase letters "^ [a-z] + $" // a string consisting of lowercase letters 26 "^ [A-Za-z0-9] + $" // composed A string consisting of a number and 26 English letters "^ \ w + $" // a string consisting of a number, 26 English 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 isvalid=eno (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 the mobile phone number: 13 [0-9] {9} www.2cto.com with 86 or + 86 before the mobile phone number: ^ (\ + 86) | (86 ))? (13) \ d {9} $ verify the phone number and mobile phone number at the same time :( ^ (\ d {3, 4 }-)? \ D {7, 8}) $ | (13 [0-9] {9}) extract the network link from 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 IP addresses from the information: (\ d + )\. (\ d + )\. (\ d + )\. (\ d +) extract the Chinese mobile phone number from the information: (86) * 0*13 \ d {9} extract the Chinese mobile phone number 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 )? China zip code in \ d {7, 14} extracted information: [1-9] {1} (\ d +) {5} extracted Chinese ID card number: \ d {18} | \ d {15} extract the integer in the information: \ d + extract the floating point in the information (that is, the decimal point ):(-? \ D *)\.? \ D + extract any number in the information :(-? \ D *) (\. \ d + )? Extract Chinese strings from the information: [\ u4e00-\ u9fa5] * extract dual-byte strings (Chinese characters) in the Information: [^ \ x00-\ xff] *

Related Article

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.