Example #1
0
        public void ConvertRegex_WithRegularExpressionInput_ParsesRegex()
        {
            var          expected = new Regex(@"\d+").ToString();
            const string input    = @"\d+";

            var converter = new RegexConverter();
            var actual    = converter.ConvertFromInvariantString(input).ToString();

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public static void ConvertWithRegex()
        {
            var converter = new RegexConverter();
            var rx        = (Regex)converter.ConvertFromInvariantString("th.s");
            var match     = rx.Match("send this home");

            Console.WriteLine("Matched regex case sensitive: {0}", match.Value);
            match = rx.Match("send thus home");
            Console.WriteLine("Matched regex case sensitive: {0}", match.Value);
            match = rx.Match("SEND THIS HOME");
            Console.WriteLine("Matched regex case sensitive: {0}", match.Value);
        }