From: http://publishblog.blogchina.com/blog/tb. B? Diaryid = 5797645
// Check whether it is composed of digits
Code
Code:
Function isdigit (s) { VaR patrn =/^ [0-9] $ /; If (! Patrn.exe C (s) return false Return true } |
// Check Logon Name: You can enter only 5-20 strings starting with a letter, which can contain numbers, "_", and ".".
Code
Code:
Function isregisterusername (s) { VaR patrn =/^ [A-Za-Z] ([a-zA-Z0-9] | [. _]) $ /; If (! Patrn.exe C (s) return false Return true } |
// Check user name: only 1-30 strings starting with letters can be entered
Code
Code:
Function istruename (s) { VaR patrn =/^ [A-Za-Z] $ /; If (! Patrn.exe C (s) return false Return true } }} |
// Password verification: only 6-20 letters, numbers, and underscores can be entered
Code:
Function ispasswd (s) { VaR patrn =/^ (\ W) $ /; If (! Patrn.exe C (s) return false Return true } |
// Verify the phone number and fax number. The phone number can start with "+" and contain "-" in addition to numbers.
Code
Code:
Function istel (s) { // Var patrn =/^ [+] (\ D) []? ([-]? (\ D) + $ /; VaR patrn =/^ [+] (\ D) []? ([-]? (\ D) | []) + $ /; If (! Patrn.exe C (s) return false Return true } |
// Verify the mobile phone number. It must start with a number and can contain "-" in addition to a number.
Code
Code:
Function ismobil (s) { VaR patrn =/^ [+] (\ D) []? ([-]? (\ D) | []) + $ /; If (! Patrn.exe C (s) return false Return true } |
// Verify the zip code
Code
Code:
Function ispostalcode (s) { // Var patrn =/^ [a-zA-Z0-9] $ /; VaR patrn =/^ [a-zA-Z0-9] $ /; If (! Patrn.exe C (s) return false Return true } |
// Verify the search keyword
Code
Code:
Function issearch (s) { VaR patrn =/^ [^ '~! @ # $ % ^ & * () + = | \] [\] \:; '\,. <>/?] [^ '~! @ $ % ^ & () + = | \] [\] \:; '\,. <>?] $ /; If (! Patrn.exe C (s) return false Return true }Function isip (s) // By zergling { VaR patrn =/^ [0-9.] $ /; If (! Patrn.exe C (s) return false Return true } |
*
......
[Read the full text]