我可以使用什么字符串在下面的第一个代码测试中输入但第二次测试失败?
public static bool ValidatePassword(string password)
{
const string symbolsDisallowed = "<>";
if (password.Length < 8) return false;
var categories = new[] { @"\d", "[A-Z]", "[a-z]", @"[^\dA-Za-z" + symbolsDisallowed + "]" };
var matchCount = categories.Count(c => Regex.IsMatch(password, c));
return matchCount >= 3 && !Regex.IsMatch(password, @"[" + symbolsDisallowed + "]");
}
第二
public static bool ValidatePasswordStrength(string password)
{
if (password.Length < 8) return false;
var categories = new[] { @"\d", "[A-Z]", "[a-z]", @"[!@#$%&\/=?_.,:;-]" };
var matchCount = categories.Count(c => Regex.IsMatch(password, c));
return matchCount >= 3;
}
谢谢