public static bool IsMatch(this IRegex c, string pattern, RegexOptions opts) { if (c.GetValue().IsNullOrEmpty()) { return(false); } return(Regex.IsMatch(c.GetValue(), pattern, opts)); }
public static string Replace(this IRegex c, string parent, string replaceMent, int count, int startAt, RegexOptions opts) { var reg = parent.As <IRegex>().ToRegex(opts); if (count <= 0) { return(reg.Replace(c.GetValue(), replaceMent)); } return(startAt >= 0 ? reg.Replace(c.GetValue(), replaceMent, count, startAt) : reg.Replace(c.GetValue(), replaceMent, count)); }
public static IEnumerable <string> Matches(this IRegex c, string parent, string groupName, RegexOptions opts) { var list = new List <string>(); if (c.GetValue().IsNullOrEmpty()) { return(list); } var ms = Regex.Matches(c.GetValue(), parent, opts); list.AddRange(from Match m in ms select m.Groups[groupName].Value); return(list); }
public static string Match(this IRegex c, string pattern, string groupName, RegexOptions opts) { return(c.GetValue().IsNullOrEmpty() ? string.Empty : Regex.Match(c.GetValue(), pattern, opts).Groups[groupName].Value); }
public static Regex ToRegex(this IRegex c) { return(new Regex(c.GetValue(), RegexOptions.Compiled)); }
public static bool IsMobile(this IRegex c) { return(RegexHelper.IsMobile(c.GetValue())); }
//常用正则 public static bool IsEmail(this IRegex c) { return(RegexHelper.IsEmail(c.GetValue())); }
public static Regex ToRegex(this IRegex c, RegexOptions opts) { return(new Regex(c.GetValue(), opts)); }