Exemplo n.º 1
0
        public static RegExpPattern WordCharacterOtherThan(
            this RegExpPattern pattern,
            WordCharacter.WordCharacterType wordCharType)
        {
            pattern.AddRule(new RegExpValue($"{RegExpWordCharacter.Build(wordCharType)}"));

            return(pattern);
        }
Exemplo n.º 2
0
        public void Test_IsMatch_30()
        {
            const string EXPECTED = @"gr[ae]y\s\S+?[\s\p{P}]";

            var pattern = new RegExpPattern()
                          .Text("gr")
                          .AnyCharacter("ae")
                          .Text("y")
                          .Character(EscapeCharacter.EscapeCharacterType.WhiteSpace)
                          .OneOrMoreOf(
                true, false,
                p => p.Character(EscapeCharacter.EscapeCharacterType.NonWhiteSpace)
                )
                          .AnyCharacter(
                RegExpEscapeCharacter.Build(EscapeCharacter.EscapeCharacterType.WhiteSpace),
                RegExpWordCharacter.Build(WordCharacter.WordCharacterType.Punctuation, true));

            pattern.ToString().Should().Be(EXPECTED);
        }