Esempio n. 1
0
        public void BalancedGroup_AngleBrackets()
        {
            var regex = RegularExpression.Of(
                CaptureGroup.Of(new CaptureGroupOptions()
            {
                Name = "Open"
            }, Literal.For("<")),
                BalancedGroup.Of("Close", "Open", Literal.For(">"))
                ).ToRegex();

            Assert.AreEqual("(?<Open><)(?<Close-Open>>)", regex.ToString());
        }
Esempio n. 2
0
        public void BalancedGroup_WithQuotes()
        {
            var regex = RegularExpression.Of(
                CaptureGroup.Of(new CaptureGroupOptions()
            {
                Name = "Open", UseQuotes = true
            }, Literal.For("<")),
                BalancedGroup.Of("Close", "Open", new BalanceGroupOptions()
            {
                UseQuotes = true
            }, Literal.For(">"))
                ).ToRegex();

            Assert.AreEqual("(?'Open'<)(?'Close-Open'>)", regex.ToString());
        }