Whether the checksum is all made up of numbers
function IsDigit (s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec (s)) return false
return True
}
Check login name: Only 5-20 entries begin with a letter, can be numbered, "_", "." The string
Java code
function Isregisterusername (s)
{
var patrn=/^[a-za-z]{1} ([a-za-z0-9]|[. _]) {4,19}$/;
if (!patrn.exec (s)) return false
return True
}
function Isregisterusername (s)
{
var patrn=/^[a-za-z]{1} ([a-za-z0-9]|[. _]) {4,19}$/;
if (!patrn.exec (s)) return false
return True
}
Verify user name: Only 1-30 strings beginning with a letter can be entered
Java code
function Istruename (s)
{
var patrn=/^[a-za-z]{1,30}$/;
if (!patrn.exec (s)) return false
return True
}
}}
Check password: Only 6-20 letters, numbers, underscores can be entered
<pre class= "java" name= "code" >function ispasswd (s)
{
var patrn=/^ (\w) {6,20}$/;
if (!patrn.exec (s)) return false
return True
}
</PRE>
<BR>
<br>//Check the ordinary telephone, fax number: Can "+" start, in addition to the number, can contain "-"
<br><pre class= "java" name= "code" >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
}
</PRE>
<BR>
<br>//Check Mobile number: Must start with a number, except the number, can contain "-"
<br><pre class= "java" name= "code" >function Ismobil (s)
{
var patrn=/^[+]{0,1} (\d) {1,3}[]? ([-]? ((\d) | []) {1,12}) +$/;
if (!patrn.exec (s)) return false
return True
}
</PRE>
<BR>
<br>//Check ZIP code
<br><pre class= "java" name= "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
}
</PRE>
<BR>
<br>//Verifying search Keywords
<br><pre class= "java" name= "code" >function Issearch (s)
{
var patrn=/^[^ ' [email protected]#$%^&* () +=|\\\][\]\{\}:; ' \,.<>/?] {1} [^ ' [email protected]$%^& () +=|\\\]
[\]\{\}:;‘ \,.<>?] {0,19}$/;
if (!patrn.exec (s)) return false
return True
}
function IsIP (s)//by zergling
{
var patrn=/^[0-9.] {1,20}$/;
if (!patrn.exec (s)) return false
return True
}
</PRE>
<BR>
<br><span style= "font-size:18pt" > Regular Expressions </SPAN>
<br><pre class= "java" name= "code" > "^\\d+$"//nonnegative integer (positive integer + 0)
"^[0-9]*[1-9][0-9]*$"//Positive integer
"^ ((-\\d+) | (0+)) $ "//non-positive integer (negative integer + 0)
"^-[0-9]*[1-9][0-9]*$"//Negative integer
"^-?\\d+$"//Integer
"^\\d+ ("//non-negative floating-point number (positive floating point + 0)
^ ([0-9]+\\]. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\\. [0-9]+) | ([0-9]*[1-9][0-9]*)) $"
Positive floating point number
"^ ((-\\d+ ("///non-positive floating-point number (negative float + 0)
^ (-([0-9]+\\]. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\\. [0-9]+) | ([0-9]*[1-9][0-9]*))) $"
Negative floating point number
^ (-?\\d+) ("//floating-point
"^[a-za-z]+$"//A string consisting of 26 English letters
"^[a-z]+$"//A string consisting of 26 uppercase letters in English
"^[a-z]+$"//String consisting of 26 English letters in lowercase
"^[a-za-z0-9]+$"//string consisting of a number and 26 English letters
"^\\w+$"//A string consisting of numbers, 26 letters or underscores
"^[\\w-]+ ("//email address
"^[a-za-z]+://("//url
"^[a-za-z0-9_]*$"
^[a-za-z0-9\.\_]+$ // number, English, decimal, underline
JS Common Regular expression authentication password user name, etc.