public void TestUnicodeCharacterRendering() { RegexNode node1 = RegexBuilder.UnicodeCharacter(0x1234); Assert.AreEqual(@"\u1234", node1.ToRegexPattern()); RegexNode node2 = RegexBuilder.UnicodeCharacter(0x7F03, RegexQuantifier.Custom(1, 4, true)); Assert.AreEqual(@"(?:\u7f03){1,4}?", node2.ToRegexPattern()); RegexNode node3 = RegexBuilder.UnicodeCharacter(0x0BA5, RegexQuantifier.Exactly(5)); Assert.AreEqual(@"(?:\u0ba5){5}", node3.ToRegexPattern()); }
public void TestMetaCharacterRendering() { RegexNode node1 = RegexBuilder.MetaCharacter(RegexMetaChars.NonWordBoundary); Assert.AreEqual(@"\B", node1.ToRegexPattern()); RegexNode node2 = RegexBuilder.MetaCharacter(RegexMetaChars.Digit, RegexQuantifier.Custom(1, 4, true)); Assert.AreEqual(@"\d{1,4}?", node2.ToRegexPattern()); RegexNode node3 = RegexBuilder.MetaCharacter(RegexMetaChars.WhiteSpace, RegexQuantifier.Exactly(5)); Assert.AreEqual(@"\s{5}", node3.ToRegexPattern()); }
public void TestAsciiCharacterRendering() { RegexNode node1 = RegexBuilder.AsciiCharacter(0x30); Assert.AreEqual(@"\x30", node1.ToRegexPattern()); RegexNode node2 = RegexBuilder.AsciiCharacter(0x7F, RegexQuantifier.Custom(1, 4, true)); Assert.AreEqual(@"(?:\x7f){1,4}?", node2.ToRegexPattern()); RegexNode node3 = RegexBuilder.AsciiCharacter(0x0B, RegexQuantifier.Exactly(5)); Assert.AreEqual(@"(?:\x0b){5}", node3.ToRegexPattern()); }