Validation:!reg.test (value)
Mailbox:
Copy Code code as follows:
Reg =/^\w+ ((-\w+) | ( \.\w+)) *\@[a-za-z0-9]+ (\.| -) [a-za-z0-9]+) *\. [a-za-z0-9]+$/i;
Does not contain Chinese:
Copy Code code as follows:
reg =/.*[\u4e00-\u9fa5]+.*$/i;
ID Number:
Verify ID number
var city = {11: ' Beijing ', 12: ' Tianjin ', 13: ' Hebei ', 14: ' Shanxi ', 15: ' Inner Mongolia ', 21: ' Liaoning ', 22: ' Jilin ', 23: ' Heilongjiang ', 31: ' Shanghai ', 32: ' Jiangsu ', 33 Zhejiang ', 34: ' Anhui ', 35: ' Fujian ', 36: ' Jiangxi ', 37: ' Shandong ', 41: ' Henan ', 42: ' Hubei ', 43: ' Hunan ', 44: ' Guangdong ', 45: ' Guangxi ', 46: ' Hainan ', 50: ' Chongqing ', 51: ' Sichuan ', 52: ' Guizhou ', 53 : ' Yunnan ', 54: ' Tibet ', 61: ' Shaanxi ', 62: ' Gansu ', 63: ' Qinghai ', 64: ' Ningxia ', 65: ' Xinjiang ', 71: ' Taiwan ', 81: ' Hong Kong ', 82: ' Macao ', 91: ' Abroad '};
function Check_idcard (n)
{
var im = 0;
var info, I, BD;
if (n.length!=)
{return
false;
}
n = n.replace (/x$/i, "a");
if (City[parseint (N.substr (0,2))] = = null)
{return
false;
}
BD = N.substr (6,4) + "-" +number (N.substr (10,2)) + "-" +number (N.substr (12,2));
var d = new Date (Bd.replace (/-/g, "/"))
if (BD!= (d.getfullyear () + "-" + (D.getmonth () +1) + "-" + d.getdate ()))
{ C19/>return false;
for (i = i >= 0; i--)
{
im + = (math.pow (2,i)%) * parseint (N.charat (17-i), one)
}
if (im% 11 != 1)
{return
false;
}
return true;
Password Strength Detection:
function Ops_pwd_set (obj) {var pwd = obj;
if (typeof obj.value!= ' undefined ') pwd = Obj.value;
if (pwd = = ") return false;
var len = pwd.length;
if (pwd = = ") {ops_show (" Password cannot be blank ", true);
return false;
///Chinese if (/[\u4e00-\u9fa5]+/.test (pwd)) {ops_show ("Password cannot contain Chinese", true);
return false;
}//blank var tmppwd = Pwd.replace (/\s+/g, "");
if (tmppwd!= pwd) {ops_show ("Password cannot contain white space characters", true);
return false;
}//Length if (Len < 6 | | len >) {ops_show ("password length is between 6-20 digits", true);
return false;
}//Regular expression var is_all_num =/^\d+$/.test (pwd);
var have_num =/\d/.test (pwd);
var is_all_abc =/^[a-za-z]+$/.test (pwd);
var have_abc =/[a-za-z]/.test (pwd);
var have_strong =/[^a-za-z0-9]/.test (pwd);
var Is_very_strong = Pwd.split (/[^a-za-z_0-9]/). length > 2;
/** * Disabled: * 1 full number and less than 8 bits * 2 password characters all the same * * var disable_msg = "This password security is too weak, not available";
if (Is_all_num && len < 8) {ops_show (disable_msg,true);
return false;
} var i=0;
var apwd = Pwd.split ('); for (I=1 i <Len;
i + +) if (Apwd[i]!= apwd[0]) break;
if (i >= len) {ops_show (disable_msg,true);
return false; /** * Extremely strong: * 1 numbers and letters with other printable characters (greater than 2 bits) and greater than or equal to 8 bits/if ((Have_num && have_abc && is_very_strong &&
Len >= 8)) {ops_show (' <font color= "#00cc00" > Extremely strong </font> ");
return true; /** * Strong: * 1 numbers and letters with other printable characters and greater than or equal to 8 bits * 2) numbers and letters with other printable characters (greater than 2 bits) and less than 8 bits * 3) 22 combination is greater than or equal to 8 bits/if (Have_num && Have_ab C && Have_strong && len >= 8) | | (Have_num && have_abc && is_very_strong && len < 8) | | ((have_num && have_strong) | | (HAVE_ABC && Have_strong))
&& len >= 8)) {ops_show (' <font color= "#00cc00" > Strong </font> ");
return true; /** *: * 1 The number is mixed with the letter and is greater than or equal to 8 bits * 2) the number and the letter and other printable characters are less than 8 bits * 3) 22 combination */if (have_num && have_abc && Len & gt;= 8) | | (Have_num && have_abc && have_strong && len < 8) | | ((Have_num && Have_strong) || (HAVE_ABC && Have_strong))
{ops_show (' <font color= ' #ff9900 ' > Password strength </font> ');
return true; /** * Weak: * 1 All numbers or letters * 2) numbers are mixed with letters and less than 8 bits/if (Is_all_num | | is_all_abc) | | (Have_num && have_abc && len < 8))
{ops_show (' <font color= ' #ff0000 ' > Password strength weak </font> ');
return true;
}//Other Ops_show (' <font color= ' #ff0000 ' > Password strength General </font> ');
return true; }
The above is a small series to introduce the detailed form to verify the regular expression of the example (recommended) The relevant knowledge, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!