JavaScript regular expression test / **************************************************** ************************************ * EO_JSLIB.JS * JavaScript regular expression inspection *** *********************************************************** **************************** /
/ / The verification is fully composed of function isdigit (s) {var patrn = / ^ [0-9] {1, 20} $ /; if (! Patrn.exec (s)) Return False Return True}
// Verify the login Name: You can only enter 5-20 letters start, can be numb, "_", "." (S) {var patrn = / ^ [A-ZA-Z] {1} ([A-ZA-Z0-9] | [._]) {4, 19} $ /; if (! Patn.exec (s)) Return False Return True}
// Check the user name: You can only enter 1-30 string function istruename (s) {var patrn = / ^ [a-za-z] {1, 30} $ /; if (! PATRN) .exec (s)) Return false Return True}
// Calibration password: You can only enter 6-20 letters, numbers, underscore function ispasswd (s) {var patrn = / ^ (/ w) {6, 20} $ /; if (! Patrn.exec (s) Return False Return True}
// Check the normal phone, fax number: " " start, in addition to the digital, "-" function istel (s) {// var patrn = / ^ [ ] {0,1} (/ d) {1,3} []? ([-]? (/ D) {1,12}) $ /; var patrn = / ^ [ ] {0, 1} (/ d) {1,3} [ ]? ([-]? ((/ d) | []) {1,12}) $ /; if (! patrn.exec (s)) Return False Return True}
// Verify the mobile number: The number must be started, in addition to the digital, "-" function ismobil (s) {var paN = / ^ [ ] {0, 1} (/ d) {1, 3} [ ]? ([-]? ((/ d) | []) {1,12}) $ /; if (! patrn.exec (s)) Return False Return True}
// Checked the Postal Code Function ISPostalcode (s) {// VAR PATRN = / ^ [A-ZA-Z0-9] {3,12} $ /; var PATRN = / ^ [A-ZA-Z0-9] {3,12} $ /; if (! Patrn.exec (s)) Return False Return True}
// Check Search Keyword Function ISSearch (s) {var PATRN = / ^ [^ `~! @ # $% ^ & * () = | ///] [/] / {/}:; '/ <> /?] {1} [^ `~! @ $% ^ & () = | ///] [/] / {/}:; '/ ,. <>?] {0,19 } $ /; if (! patrn.exec (s)) Return False Return True}