cfRegeX


Metacharacter Reference Chart

The following table lists each metacharacter, what it does, and links to where you can find out more about it.

Metacharacter Meaning More info
\ Escape or create metacharacter. Metacharacters
^ Start of input, or start of line in multiline mode. Positions
\A Start of input. Positions
$ End of input, or end of line in multiline mode. Positions
\z End of input. Positions
\Z End of input, before trailing newline. Positions
\b Word boundary, between word and non-word characters. Positions
\B Inverse of word boundary. Positions
(?=) Lookahead, contains a regex expression. Lookarounds
(?!) Negative lookahead, contains a regex expression. Lookarounds
(?<=) Lookbehind, contains a limited-width regex expression. Lookarounds
(?<!) Negative lookbehind, contains a limited-width regex expression. Lookarounds
\n Newline character. Encoded Characters
\r Carriage return character. Encoded Characters
\t Tab character. Encoded Characters
\x## ASCII encoded character, ## is hex digit from 00 to FF. Encoded Characters
\u#### Unicode encoded character, #### is hex digit, from 0000 to FFFF. Encoded Characters
\0### Octal encoded character, ### is octal digit, from 000 to 377. Encoded Characters
[] Character class, match any one char in class. Character Classes
[^] Negative character class, match any one char not in class. Character Classes
\d Any single digit character. Character Classes
\w Any single word character. Character Classes
\s Any single whitespace character. Character Classes
\D Any single non-digit character. Character Classes
\W Any single non-word character. Character Classes
\S Any single non-whitespace character. Character Classes
\p{Xxxxx} POSIX character classes, Xxxxx is keyword. POSIX Classes
\P{Xxxxx} POSIX negative character classes, Xxxxx is keyword. POSIX Classes
\p{Xx} Unicode character classes, Xx is one or two letter code. Unicode Classes
\P{Xx} Unicode negative character classes, Xx is one or two letter code. Unicode Classes
{} Greedy numeric quantifier, contains fixed number, minimum, or range. Quantifiers
{}? Lazy numeric quantifier, contains fixed number, minimum, or range. Quantifiers
{}+ Possessive numeric quantifier, contains minimum, or range. Quantifiers
? Greedy optional quantifier (1 or 0). Quantifiers
?? Lazy optional quantifier (0 or 1). Quantifiers
* Greedy non-required quantifier (as many as possible, zero required). Quantifiers
*? Lazy non-required quantifier (zero, or as few as possible). Quantifiers
*+ Possessive non-required quantifier (as many as possible, zero required). Quantifiers
+ Greedy required quantifier (as many as possible, one required). Quantifiers
+? Lazy required quantifier (at least one, as few as possible). Quantifiers
++ Possessive required quantifier (as many as possible, one required). Quantifiers
() Capturing group, contains a regex expression. Grouping
(?:) Non-capturing group, contains a regex expression. Grouping
(?>) Atomic non-capturing group, contains a regex expression. Grouping
\1 to \99 Backreference to captured group Backreferences
| Alternation Alternation