日期:2014-05-16  浏览次数:20394 次

求一个正则表达式,测试通过结贴给分
要求:
密码设置规范:长度6位以上,须包含大写、小写、数字、特殊符号中的任意3种。


------解决方案--------------------
没研究过有一个就可以解决 的,但同个却有,


  function checkPS(ps) {
var len = 0;
if(ps.length >= 6) {
var rs = /[A-Z]/;
if(rs.test(ps)) {
len++;
}
rs = /[a-z]/;
if(rs.test(ps)) {
len++;
}
rs = /[0-9]/;
if(rs.test(ps)) {
len++;
}
rs = /[^A-Za-z0-9]/;
if(rs.test(ps)) {
len++;
}
      }
      return len >= 3;
}

var ps = 'ZD5007 = $qt$#ZD5019$qt$ and isnull(ZFBZ,0)=0 and ';

checkPS(ps);
------解决方案--------------------
^(?:(?=(?:[a-z\d]
------解决方案--------------------
[^A-Za-z\d])*?[A-Z])(?=(?:[A-Z\d]
------解决方案--------------------
[^A-Za-z\d])*?[a-z])(?=(?:[a-zA-Z]
------解决方案--------------------
[^A-Za-z\d])*?\d)[a-zA-Z\d]{6,}
------解决方案--------------------
(?=(?:[a-z\d]
------解决方案--------------------
[^A-Za-z\d])*?[A-Z])(?=(?:[A-Z\d]
------解决方案--------------------
[^A-Za-z\d])*?[a-z])(?=(?:[a-zA-Z\d])*?[^A-Za-z\d])(?:[A-Za-z]
------解决方案--------------------
[^A-Za-z\d]){6,}
------解决方案--------------------
(?=(?:[a-z\d]
------解决方案--------------------
[^A-Za-z\d])*?[A-Z])(?=(?:[a-zA-Z]
------解决方案--------------------
[^A-Za-z\d])*?\d)(?=(?:[a-zA-Z\d])*?[^A-Za-z\d])(?:[A-Z\d]
------解决方案--------------------
[^A-Za-z\d]){6,}
------解决方案--------------------
(?=(?:[A-Z\d]
------解决方案--------------------
[^A-Za-z\d])*?[a-z])(?=(?:[a-zA-Z]
------解决方案--------------------
[^A-Za-z\d])*?\d)(?=(?:[a-zA-Z\d])*?[^A-Za-z\d])(?:[a-z\d]
------解决方案--------------------
[^A-Za-z\d]){6,})$