Example #1
0
        public Regex Regex( string pattern, RegexOptions options )
        {
            var key = string.Format( CultureInfo.InvariantCulture, "{0}:{1}", pattern.GetHashCode(), options.GetHashCode() );

            if ( cache.ContainsKey( key ) ) {
                return cache[key];
            }

            var regex = new Regex( pattern, options );

            cache.Add( key, regex );

            return regex;
        }
Example #2
0
        public Regex Regex(string pattern, RegexOptions options)
        {
            var key = string.Format(CultureInfo.InvariantCulture, "{0}:{1}", pattern.GetHashCode(), options.GetHashCode());

            if (cache.ContainsKey(key))
            {
                return(cache[key]);
            }

            var regex = new Regex(pattern, options);

            cache.Add(key, regex);

            return(regex);
        }