JS Latest mobile phone number, ID card regular expression

Source: Internet
Author: User

ID Card Regular:

//identity card Regular expression (15-bit)isidcard1=/^[1-9]\d{7}((0\d) | (1[0-2]))(([0|1|2]\D) |3[0-1]) \d{3}$/;//identity card Regular expression (18-bit)isidcard2=/^[1-9]\d{5}[1-9]\d{3}((0\d) | (1[0-2]))(([0|1|2]\D) |3[0-1]) \d{4}$/the identity card is consolidated: (^\d{ the}$)| (^\d{ -}([0-9]| X) $)

The latest mobile phone number regular expression:

var tel = $ ("#telNo"). Val (); Get mobile number var Telreg =!! Tel.match (/^ (0|86|17951)? ( 13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]) [0-9]{8}$/);//If the mobile number cannot be verified by the IF (Telreg = = False) {}

Other

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 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]*

Use:

The test () method looks in the string for the presence of the specified regular expression and returns a Boolean value that returns true if it exists, otherwise false.

varPattern =NewREGEXP ('Box','I');varstr ='Box'; alert (Pattern.test (str));//truevarPattern =/box/i;varstr ='Box'; alert (Pattern.test (str));//truevarPattern =/box/i;varstr ='This is a box'; alert (Pattern.test (str));//true

JS Latest mobile phone number, ID card regular expression

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.