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