Character EscapesThe backslash character (\) in a regular expression indicates that the character that follows it either is a special character (as shown in the following table), or should be interpreted literally.
Character ClassesA character class matches any one of a set of characters. Character classes include the language elements listed in the following table.
AnchorsAnchors, or atomic zero-width assertions, cause a match to succeed or fail depending on the current position in the string, but they do not cause the engine to advance through the string or consume characters. The metacharacters listed in the following table are anchors.
Grouping ConstructsGrouping constructs delineate subexpressions of a regular expression and typically capture substrings of an input string. Grouping constructs include the language elements listed in the following table.
QuantifiersA quantifier specifies how many instances of the previous element (which can be a character, a group, or a character class) must be present in the input string for a match to occur. Quantifiers include the language elements listed in the following table.
Backreference ConstructsA backreference allows a previously matched subexpression to be identified subsequently in the same regular expression. The following table lists the backreference constructs supported by regular expressions in .NET.
Alternation ConstructsAlternation constructs modify a regular expression to enable either/or matching. These constructs include the language elements listed in the following table.
SubstitutionsSubstitutions are regular expression language elements that are supported in replacement patterns. The metacharacters listed in the following table are atomic zero-width assertions.
Regular Expression OptionsYou can specify options that control how the regular expression engine interprets a regular expression pattern. Many of these options can be specified either inline (in the regular expression pattern) or as one or more RegexOptions constants. This quick reference lists only inline options. You can specify an inline option in two ways:
The .NET regular expression engine supports the following inline options:
Miscellaneous ConstructsMiscellaneous constructs either modify a regular expression pattern or provide information about it. The following table lists the miscellaneous constructs supported by .NET.
|