操控平台后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

4 months ago
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Core;
/// <summary>
/// 正则校验
/// </summary>
public static class RegularValidate
{
/// <summary>
/// 验证密码规则
/// </summary>
/// <param name="password"></param>
/// <returns></returns>
public static bool ValidatePassword(string password)
{
var regex = new Regex(@"
(?=.*[0-9]) #
(?=.*[a-z]) #
(?=.*[A-Z]) #
(?=([\x21-\x7e]+)[^a-zA-Z0-9]) #
.{8,30} #830
", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
//如果要求必须包含小写、大写字母,则上面的(?=.*[a-zA-Z]) 要改为:
/*
* (?=.*[a-z])
* (?=.*[A-Z])
*/
return regex.IsMatch(password);
}
}