Пример #1
0
 /// <summary>
 /// 验证和正则表达式是否匹配
 /// </summary>
 /// <param name="box">验证框</param>        
 /// <param name="regexPattern">表达式</param>    
 /// <returns></returns>
 public static ValidBox Match(this ValidBox box, string regexPattern)
 {
     var newBox = new MatchAttribute(regexPattern).ToValidBox();
     return ValidBox.Merge(box, newBox);
 }
Пример #2
0
 /// <summary>
 /// 验证和正则表达式是否匹配
 /// </summary>
 /// <param name="box">验证框</param>        
 /// <param name="regexPattern">表达式</param>
 /// <param name="errorMessage">提示信息</param>
 /// <returns></returns>
 public static ValidBox Match(this ValidBox box, string regexPattern, string errorMessage)
 {
     var newBox = new MatchAttribute(regexPattern) { ErrorMessage = errorMessage }.ToValidBox();
     return ValidBox.Merge(box, newBox);
 }