Pattern | Description |
---|---|
Constant Escape Characters | |
\a | This matches the bell character: \u0007. For example, it matches "Test" + '\u0007' |
\b | This matches the backspace character: \u0008. For example, it matches "Test" + '\u0008' |
\t | This matches the tab character: \u0009. For example, it matches "Test" + '\u0009' |
\n | This matches the newline character: \u000A. For example, it matches "Test" + '\u000A' |
\v | This matches the vertical tab character: \u000B. For example, it matches "Test" + '\u000B' |
\f | This matches the form feed character: \u000C. For example, it matches "Test" + '\u000C' |
\r | This matches the carriage return character: \u000D. For example, it matches "Test" + '\u000D' |
\e | This matches the escape character: \u001B. For example, it matches "Test" + '\u001B' |
Variable Escape Characters | |
\cA | This matches the Ctrl-A character for an ASCII character. |
\ooo | This matches the ASCII character with the octal value ooo. |
\xhh | This matches the ASCII character with the hexadecimal value hh. |
\uhhhh | This matches the Unicode character with the hexadecimal value hhhh. |
Character Classes | |
. | This matches any single character, except newline and carriage return. It is used as a placeholder. So, the pattern fa.e matches "face", "fade", "fare", "fate", "fake", or "fame" |
x..x | This matches anything with an "x" at each end and two characters in between; for example, it matches "xoax" or "xslx". |
\w | This matches any word character. |
\W | This matches any non-word character. |
\d | This matches any decimal digit character. |
\D | This matches any character that is not a decimal digit. |
\s | This matches any white-space character. |
\S | This matches any non-white-space character. |
[...] | This matches any character inside the brackets. For example, [dox] matches "d", "o", or "x". |
[az] | This matches any "a" or "z" character. For example, it matches the second and third characters of "raze" for the "a" and "z" at those locations. |
fa[cdr]e | This matches the patterns "face", "fade" and "fare". |
[^...] | This matches any character that is not inside the brackets. For example, [^dox] matches anything except "d", "o", or "x". |
http[^s] | This matches any "http" this is not followed by an "s". So, it matches the beginning of "http://xoax.net/", but not "https://xoax.net/". |
[First-Last] | This matches any character from "First" to "Last", inclusive. For example, [r-x] matches "r", "s", ..., "x". |
[^First-Last] | This matches any character, except from "First" to "Last", inclusive. For example, [^r-x] matches anything except "r", "s", ..., "x". |
\p{unicode category} | This matches any character in the unicode category. |
\P{unicode category} | This matches any character that is not in the unicode category. |
Quantifiers | |
* | This matches the preceding element zero or more times. |
x..x.* | This matches anything with an "x" followed by any two characters and then an "x"; for example, it matches "xoax" or "xoax.net", but not "xox" or "xoa". |
+ | This matches the preceding element one or more times. |
x..x.+ | This matches anything with an "x" followed by any two characters and then an "x" and one or more characters; for example, it matches "xoaxn" or "xoax.net", but not "xoax". |
? | This matches the preceding element zero or one time. |
x..x.? | This matches anything with an "x" followed by any two characters and then an "x" and at most one more character; for example, it matches "xoax" or "xoax.", but not "xoax.net". |
{n} | This matches the preceding element n times. |
{n,} | This matches the preceding element at least n times. |
{n,m} | This matches the preceding element at least n times but no more than m times. |
Anchors | |
^ | This must match the first position of a string or the first position of any line. |
^cat | This matches the beginning of a string or line that begins with "cat", such as "category" but not "decathlon". |
$ | This must match the last position of a string or the last position of any line. |
cat$ | This matches the end of a string or line that ends with "cat", such as "requiescat" or "magnificat" but not "desiccated". |
\A | This must match the start of a string. |
\Z | This must match the end of a line, just before a newline. |
\z | This must match the end of a string. |
\G | This must match where a previous match ended. |
\b | This must match on the boundary between an alphanumeric and a nonalphanumeric character. |
\B | This must match on somewhere other than the boundary between an alphanumeric and a nonalphanumeric character. |
Groups | |
(subexpression) | This captures the matched subexpression as a group and assigns it a one-based index. |
(?<name>subexpression) or (?'name'subexpression) |
This captures the matched subexpression as a group and assigns it to name. |
(?<name1-name2>subexpression) or (?'name1-name2'subexpression) |
This defines a balancing group definition. |
(?:subexpression) | This defines a noncapturing group. |
(?imnsx-imnsx:subexpression) | This applies or disables the specified options within the subexpression. |
(?=subexpression) | This defines a zero-width positive lookahead assertion. |
(?!subexpression) | This defines a zero-width negative lookahead assertion. |
(?<=subexpression) | This defines a zero-width positive lookbehind assertion. |
(?<!subexpression) | This defines a zero-width negative lookbehind assertion. |
(?>subexpression) | This defines an atomic group. |
© 20072025 XoaX.net LLC. All rights reserved.