ID Card Regular:
Identity card Regular expression (15-bit) isidcard1=/^[1-9]d{7} ((0d) | ( 1[0-2]) (([0|1|2]d) |3[0-1]) d{3}$/;//ID Regular expression (18-bit) isidcard2=/^[1-9]d{5}[1-9]d{3} ((0d) | ( 1[0-2]) (([0|1|2]d) |3[0-1]) d{4}$/; identity card consolidation: (^d{15}$) | (^d{17} ([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 information from the image link: (s| S) (r| R) (c| C) *= * (' | ')? (w|\|/|.) + (' | ' | *|>)? The IP address in the extracted information: (d+). (d+). (d+). (d+) Chinese mobile phone number in extracting information: (*0*13D{9) The Chinese fixed number in extracting information: ((d{3,4}) |d{3,4}-|s)? D{8} Extract the Chinese phone number (including mobile and landline) from the Information:((d{3,4}) |d{3,4} -|s)? D{7,14} Extract information in China postcode: [1-9]{1} (d+) {5} Extract information from China ID: d{18}|d{15} Extract the Integer in the information: d+ extract the floating-point number in the information (that is, decimal): (-?d*).? D+ extract any number in the information: (-?d*) (. d+)? Extract the Chinese string in 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.
var pattern = new RegExp (' box ', ' I '); var str = ' box '; alert (Pattern.test (str)); Truevar pattern =/box/i;var str = ' Box '; alert (Pattern.test (str)); Truevar pattern =/box/i;var str = ' This is a Box '; Alert (Pattern.test (str)); True
JS Latest mobile phone number, ID card regular expression