https://github.com/Alwayswithme/exercise/blob/master/JavaScript/validate.jsvalidatePasswordByRule(6,20,4,'a');
Object { result: false, msg: "密码长度范围须为6~20" }
validatePasswordByRule(6,20,4,'LINUX1;');
Object { result: false, msg: "密码须包含小写字母" }
validatePasswordByRule(6,20,4,'aaab1[');
Object { result: false, msg: "密码须包含大写字母" }
validatePasswordByRule(6,20,4,'aaaBs[');
Object { result: false, msg: "密码须包含数字" }
validatePasswordByRule(6,20,4,'aaaBsd1');
Object { result: false, msg: "密码须包含标点符号" }
validatePasswordByRule(6,20,4,'aaaaBsd1;');
Object { result: false, msg: "密码有太多重复字符" }
validatePasswordByRule(6,20,4,'aaaBsd1;');
Object { result: true, msg: "密码符合规则" }
是这样吗,不过43行是硬编码,你自己算一下