JS Regular expression implementation of mobile phone number, password validation

Source: Internet
Author: User

Mobile phone number, password is verified.

Share the format verification of the next JavaScript expression, commonly used mobile phone number, password and so on.

/** * Mobile phone number * Move: 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188* unicom: 130,131,132,152,155,156,185,186* Telecommunications: 133,1349,153,180,189*/NSString* MOBILE = @ "^1 (3[0-9]|5[0-35-9]|8[025-9]) \\d{8}$";/** * Mobile: China mobile* 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188*/NSString* CM = @ "^1 (34[0-8]| ( 3[5-9]|5[017-9]|8[278]) \\d) \\d{7}$ ";/** * Unicom: China unicom* 130,131,132,152,155,156,185,186*/NSString* CU = @ "^1 (3[0-2]|5[256]|8[56]) \\d{8}$";/** * China Telecom: Chinese telecom* 133,1349,153,180,189*/NSString* CT = @ "^1 ((33|53|8[09]) [0-9]|349) \\d{7}$";/** * Area landline and PHS * Area code: 010,020,021,022,023,024,025,027,028,029* Number: seven-bit or eight-bit*///NSString * PHS = @ "^0 (10|2[0-5789]|\\d{3}) \\d{7,8}$";Password^(?=.*? [A-za-z]) (?=.*? [0-9]) [A-za-z0-9] {6,20}$"^\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/^13\d{9}$/GI mobile number Regular expression//www.jbxue.compublic static bool Isvalidmobileno (string Mobileno) {const string Regpattern= @ "^ (130|131|132|133|134|135|136|137|138|139) \d{8}$"; returnRegex.IsMatch (Mobileno, Regpattern);}

Regular expression--verify mobile: 13[0-9]{9}

86 or +86 in front of mobile phone number: ^ ((\+86) | (86))? (\d{9}$)
The phone number and phone number are simultaneously verified: (^ (\d{3,4}-)? \d{7,8}) $| (13[0-9]{9})
To extract information from a network link: (h| H) (r| R) (e| E) (f| F) *= * (' | ')? (\w|\\|\/|\.) + (' | ' | *|>)?
Message address in Extract information: \w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *
Extract the image link from the information: (s| S) (r| R) (c| C) *= * (' | ')? (\w|\\|\/|\.) + (' | ' | *|>)?
Extract the IP address in the information: (\d+) \. (\d+) \. (\d+) \. (\d+)
Chinese mobile phone number in extracting information: (*0*13\D{9)
Chinese fixed phone number in extracting information: (\ (\d{3,4}\) |\d{3,4}-|\s)? \d{8}
Chinese phone numbers in the extraction information (including mobile and landline):(\ (\d{3,4}\) |\d{3,4}-|\s)? \d{7,14}
Extract the information in China Postcode: [1-9]{1} (\d+) {5}
Chinese identity card number in extracting information: \d{18}|\d{15}
Extract 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]*

JS Regular expression implementation of mobile phone number, password validation

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.