var upperCase = newRegExp("[A-Z]"); var lowerCase = newRegExp("[a-z]"); var numbers = newRegExp("[0-9]"); var specialchars = newRegExp("([!,%,&,@,#,$,^,*,?,_,~])"); var specialchars = /(`|\-|=|\[|\]|;|’|,|\.|\/|~|\!|@|#|\$|%|\^|&|\*|\(|\)|_|\+|\{|\}|:|”|<|>|\?|\|)/; // 特殊字符 `-=[];’,./~!@#$%^&*()_+{}:”<>?|
if (password.length > 8) { score++; }
if (password.match(upperCase)) { score++; } if (password.match(lowerCase)) { score++; } if (password.match(numbers)) { score++; } if (specialchars.test(password)) { score++; }