Regexes
The Regular Expression engine provided by ParserObjects has fewer features than an ordinary Regular Expression engine, such as the one provided by the System.Text.Regex
class. The following features are supported:
- Literal characters
"abc"
- Wildcards
.
- Basic Quantifiers
- Zero or One
?
- Zero or More
*
- One or More
+
- Zero or One
- Range quantifiers
{3}
exactly three{3,}
at least three{,5}
at most five{3,5}
between three and five
- Capturing Groups
( )
- Backreferences
\1
- Backreferences
- Non-Capturing Cloisters
(?: )
- Alternations
|
- Character Classes
[abc]
literal characters[a-cA-C]
character ranges[^abc]
and[^a-c]
inverted ranges
- Built-In Character Classes
\s
and\S
whitespace and non-whitespace\w
and\W
word and non-word\d
and\D
digit and non-digit
$
End anchor
The Regex parser always attempts to match the pattern starting at the current position of the input sequence, and will not look forward to try and find a match which begins later. Because of this, the Regex parser does not support the beginning of input anchor (^
) in patterns. However, it does support the end of input anchor ($
) to match the end of input of the sequence.