Ejemplo n.º 1
0
        public CachedRegex(Regex r)
        {
            regex = r;

            is_match_cache = new OperationCache <bool, string>("is_match_cache", delegate(string input) {
                return(input.RegexIsMatch(regex));
            });
            match_cache = new OperationCache <Match, string>("match_cache", delegate(string input) {
                return(input.RegexMatch(regex));
            });
            matches_cache = new OperationCache <MatchCollection, string>("matches_cache", delegate(string input) {
                return(input.RegexMatches(regex));
            });

            split_cache = new OperationCache <string[], string>("split_cache", delegate(string input) {
                return(input.RegexSplit(regex));
            });
            replace_cache = new OperationCache <CachedRegexReplaceMatchCollection, string>("replace_cache", delegate(string input) {
                return(new CachedRegexReplaceMatchCollection(input, Matches(input)));
            });
        }