首页 > 代码库 > js 正则

js 正则

function isCheck(s){

var check_qiang  = /^(?=.{10,})(((?=.*[A-Z])(?=.*[a-z])(?=.*\W))|((?=.*[A-Z])(?=.*[0-9])(?=.*\W))|((?=.*[a-z])(?=.*[0-9])(?=.*\W))).*$/;

var check_zhong  = /^(?=.{10,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$/;

var check_ruo    = /^(?=.{8,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$/;

if(check_qiang.test(s)) {

$(‘#ruo‘).addClass(‘pwdChange‘); 

$(‘#zhong‘).addClass(‘pwdChange‘); 

$(‘#qiang‘).addClass(‘pwdChange‘);

} else if(check_zhong.test(s)) {

$(‘#ruo‘).addClass(‘pwdChange‘); 

$(‘#zhong‘).addClass(‘pwdChange‘); 

$(‘#qiang‘).removeClass(‘pwdChange‘); 

} else if( check_ruo.test(s)) {

$(‘#ruo‘).addClass(‘pwdChange‘); 

$(‘#zhong‘).removeClass(‘pwdChange‘); 

$(‘#qiang‘).removeClass(‘pwdChange‘);

} else {

$(‘#ruo‘).removeClass(‘pwdChange‘); 

$(‘#zhong‘).removeClass(‘pwdChange‘);

$(‘#qiang‘).removeClass(‘pwdChange‘);  

}


js 正则