Exemplo n.º 1
0
        public static Regex CommaSeparatedRegex(Regex element, int minCount)
        {
            Regex regex1 = HttpRegex.Any(HttpRegex.LinearWhiteSpace);
            Regex regex2 = HttpRegex.Concat(HttpRegex.Build(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}{1}", new object[2]
            {
                (object)regex1,
                (object)element
            })), HttpRegex.AtLeast(HttpRegex.Build(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0},{1}{2}", (object)regex1, (object)regex1, (object)element)), minCount - 1));

            if (minCount > 0)
            {
                return(regex2);
            }
            return(HttpRegex.Optional(regex2));
        }
Exemplo n.º 2
0
 public static Regex AtLeast(Regex regex, int minCount)
 {
     if (minCount <= 0)
     {
         return(HttpRegex.Any(regex));
     }
     if (minCount == 1)
     {
         return(HttpRegex.AtLeastOne(regex));
     }
     return(HttpRegex.Build(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "(?:{0}){{{1},}}", new object[2]
     {
         (object)regex,
         (object)minCount
     })));
 }