Symbol
|
Description
|
\|Marks the next character as either a special character (such as \n for the newline character) or as a literal (if that character otherwise has special meaning in a pattern search string). The special characters are:|
| |
|\f|
| |
|form feed character|
| |
|\n|
| |
|newline character|
| |
|\r|
| |
|carriage return character|
| |
|\t|
| |
|tab character|
| |
|\v|
| |
|vertical tab character|
| |
^|Matches the beginning of input.|
$|Matches the end of input.|
*|Matches the preceding atom zero or more times.|
+|Matches the preceding atom one or more times.|
?|Matches the preceding atom zero or one time.|
.|Matches any single character except a newline character.|
( )|Defines a subexpression within the larger subexpression. A subexpression:|
| |
|Overrides the order of precedence used in evaluating pattern strings.|
| |
|Can be referenced again in the pattern string. To insert the result of the subexpression later in the pattern string, reference it by its one-based ordinal position among subexpressions, preceded by the backslash symbol (e.g., \1). See the example using the \num syntax in the "Programming Tips and Gotchas" section.|
| |
|Can be referenced again in the replacement string in calls to the RegExp.Replace method. To use the result of the original subexpression as a replacement string, reference its one-based ordinal position among subexpressions, preceded by a dollar sign (e.g., $1). See RegExp.Replace Method for an example.|
| |
x|y|Matches either x or y.|
{n}|Matches exactly n times, where n is a nonnegative integer.|
{n,}|Matches at least n times, where n is a nonnegative integer. o{1,} is the same as o+, and o{0,} is the same as o*.|
{n,m}|Matches at least n and at most m times, where m and n are nonnegative integers. o{0,1} is the same as o?.|
[abc]|Matches any one of the enclosed characters (represented by abc) in the character set.|
[^xyz]|Matches any character (represented by xyz) not enclosed in the character set. For example, [^abc] matches the "p" in "plain."|
[a-z]|Matches any character in a range of characters (represented by a-z).|
[^m-z]|Matches any character not included in a range of characters (represented by m-z).|
\b|Matches a word boundary; that is, the position between a word and a space. The word boundary symbol does not include newline characters or the end of input (see the \s symbol).|
\B|Matches a nonword boundary. ea*r\B matches the "ear" in "never early."|
\d|Matches a digit character. Equivalent to [0-9].|
\D|Matches a nondigit character. Equivalent to [^0-9].|
\s|Matches any whitespace, including space, tab, form-feed, etc. Equivalent to [ \f\n\r\t\v].|
\S|Matches any nonwhitespace character. Equivalent to [^ \f\n\r\t\v].|
\w|Matches any word character including underscore. Equivalent to [A-Za-z0-9_].|
\W|Matches any nonword character, including whitespace and carriage returns. Equivalent to [^A-Za-z0-9_].|
\num|Matches the subexpression (enclosed in parentheses) whose ordinal position in the pattern is num, where num is a positive integer.|
\n|Matches n, where n is the octal value of an ASCII code. Octal escape values must be 1, 2, or 3 digits long and must not exceed 256; if they do, only the first two digits are used.|
\xn|Matches n, where n is the hexadecimal value of an ASCII code. Hexadecimal escape values must be two digits long.|