密码验证
/// <summary> /// 新密码强度策略检验 /// </summary> /// <param name="str">密码</param> /// <returns></returns> private bool CheckPwdNew(string str) { bool flag = false; try { var regex = new Regex("^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,30}$");//必须包含数字,字母大小写,特殊字符,其中的三种及其以上,且长度大于8小于30 if (regex.IsMatch(str)) flag = true; } catch (Exception ex) { throw new Exception(ex.Message); } return flag; }