Beispiel #1
0
        /// <summary>
        /// Initialise a <see cref="CompiledRegexEntry"/> with the specified pattern, name and Namespace
        /// </summary>
        internal CompiledRegexClass(Regex regex) : base("temp", "temp")
        {
            _regex = regex;

            _pattern = _regex.ToString();

            _matchTimeout = _regex.MatchTimeout;
            _options      = _regex.Options;

            Type t = regex.GetType();

            _name      = t.Name;
            _namespace = t.Namespace;
        }
 public RegularExpressionException(Regex regularExpression, string target, Exception innerException)
     : base(string.Concat(""), innerException)
 {
     string[] textArray1 = new string[5] { "Regular expression failed: ", regularExpression.GetType().ToString(), " working on '", target, "'" } ;
 }
 public RegularExpressionException(Regex regularExpression, Exception innerException)
     : base("Regular expression failed: " + regularExpression.GetType().ToString(), innerException)
 {
 }
Beispiel #4
0
            public SearchQuery(string regex, RegexOptions options)
            {
                Text = regex;
                Regex = new Regex(regex, RegexOptions.Compiled | RegexOptions.ExplicitCapture | options);

                // Ph'nglui Mglw'nafh Regex R'lyeh wgah'nagl fhtagn
                var tempRe = new Regex(regex, RegexOptions.ExplicitCapture);
                var recode = tempRe.GetType().GetField("code", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tempRe);
                var words = (string[])(recode.GetType().GetField("_strings", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(recode));
                var result = new List<string>();
                foreach (var word in words) {
                    if (word.Contains('\0'))
                        continue;

                    result.Add(word);
                }
                SearchWords = result.ToArray();
            }