操作正则表达式的公共类


1
/// <summary> 2 /// 操作正则表达式的公共类 3 /// </summary> 4 public class RegexHelper 5 { 6 #region 验证输入字符串是否与模式字符串匹配 7 /// <summary> 8 /// 验证输入字符串是否与模式字符串匹配,匹配返回true 9 /// </summary> 10 /// <param name="input">输入字符串</param> 11 /// <param name="pattern">模式字符串</param> 12 public static bool IsMatch(string input, string pattern) 13 { 14 return IsMatch(input, pattern, RegexOptions.IgnoreCase); 15 } 16 17 /// <summary> 18 /// 验证输入字符串是否与模式字符串匹配,匹配返回true 19 /// </summary> 20 /// <param name="input">输入的字符串</param> 21 /// <param name="pattern">模式字符串</param> 22 /// <param name="options">筛选条件</param> 23 public static bool IsMatch(string input, string pattern, RegexOptions options) 24 { 25 return Regex.IsMatch(input, pattern, options); 26 } 27 #endregion 28 }

 

posted @ 2016-09-23 08:51  百年明日能几何  阅读(197)  评论(0编辑  收藏  举报