Пример #1
0
    public static string ExpandCharClass(string charClass)
    {
        var regexParser = new RegexParser(CultureInfo.CurrentCulture);

        regexParser.SetPattern(charClass);
        var           regexCharClass = regexParser.ScanCharClass(false);
        int           count          = regexCharClass.RangeCount();
        List <string> ranges         = new List <string>();

        // range 0 can be skipped
        for (int i = 1; i < count; i++)
        {
            var range = regexCharClass.GetRangeAt(i);
            ranges.Add(ExpandRange(range));
        }
        return(String.Concat(ranges));
    }