Check whether it consists entirely of numbers
function isDigit(s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}
Verify login name: You can only enter 5-20 strings starting with letters and including numbers, "_", and "."
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
}
Verify user name: Only 1-30 strings starting with letters can be entered
Java code
function isTrueName(s)
{
var patrn=/^[a-zA-Z]{1,30}$/;
if (!patrn.exec(s)) return false
return true
}
Verification password: Only 6-20 letters, numbers, and underscores can be entered
function isPasswd(s)
{
var patrn=/^(w){6,20}$/;
if (!patrn.exec(s)) return false
return true
}
Verify ordinary telephone and fax numbers: they can start with "+" and may contain "-" in addition to numbers.
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
}
Verification mobile phone number: must start with a number. In addition to numbers, it can contain "-"
function isMobil(s)
{
var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$/;
if (!patrn.exec(s)) return false
return true
}
Verify zip 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
}