Example #1
0
        public void GetMatchesTest()
        {
            var verbEx = VerbalExpressions
                         .DefaultExpression
                         .StartOfLine()
                         .Then("http")
                         .Maybe("s")
                         .Then("://")
                         .Maybe("www.")
                         .AnythingBut(" ")
                         .EndOfLine();

            const string testMe = "https://www.google.com";

            var matches = RegExHelper.GetMatches(verbEx, testMe);

            Assert.AreEqual(1, matches.Count);

            matches = RegExHelper.GetMatches(verbEx, testMe + " ");

            Assert.AreEqual(null, matches);
        }