PCRE supports the metacharacters and metasequences listed in Table 1-26 through Table 1-30. For expanded definitions of each metacharacter, see Section 1.2.1.
Sequence |
Meaning |
|
Alert (bell), |
|
Backspace, |
|
ESC character, |
|
Newline, |
|
Carriage return, |
|
Form feed, |
|
Horizontal tab, |
|
Character specified by a three-digit octal code. |
|
Character specified by a one- or two-digit hexadecimal code. |
|
Character specified by any hexadecimal code. |
|
Named control character. |
Class |
Meaning |
|
A single character listed or contained in a listed range. |
|
A single character not listed and not contained within a listed range. |
|
POSIX-style character class valid only within a regex character class. |
. |
Any character except newline (unless single-line mode,
|
|
One byte; however, this may corrupt a Unicode character stream. |
|
Word character, |
|
Non-word character, |
|
Digit character, |
|
Non-digit character, |
|
Whitespace character, |
|
Non-whitespace character, |
Sequence |
Meaning |
|
Start of string, or after any newline if in multiline match mode,
|
|
Start of search string, in all match modes. |
|
End of search string or before a string-ending newline, or before any
newline if in multiline match mode, |
|
End of string or before a string-ending newline, in any match mode. |
|
End of string, in any match mode. |
|
Beginning of current search. |
|
Word boundary; position between a word character
( |
|
Not-word-boundary. |
|
Positive lookahead. |
|
Negative lookahead. |
|
Positive lookbehind. |
|
Negative lookbehind. |
Modifier/sequence |
Mode character |
Meaning |
|
|
Case-insensitive matching for characters with codepoints values less than 256. |
|
|
|
|
|
Dot (.) matches newline. |
|
|
Ignore whitespace and allow comments ( |
|
|
Reverse greediness of all quantifiers: |
|
Force match to start at the first position searched. | |
|
Force | |
|
Disable capturing function of parentheses. | |
|
Treat regular expression and subject strings as strings of multibyte UTF-8 characters. | |
|
Turn listed modes ( | |
|
Turn listed modes ( | |
|
Turn listed modes ( | |
|
Turn listed modes ( | |
|
Quote all following regex metacharacters. | |
|
End a span started with | |
|
Treat substring as a comment. | |
|
Treat rest of line as a comment in |
Sequence |
Meaning |
|
Group subpattern and capture submatch into
|
|
Group subpattern and capture submatch into named capture group,
|
|
Contains the results of the |
|
Group subpattern, but do not capture submatch. |
|
Disallow backtracking for text matched by subpattern. |
|
Try subpatterns in alternation. |
|
Match 0 or more times. |
|
Match 1 or more times. |
|
Match 1 or 0 times. |
|
Match exactly |
|
Match at least |
|
Match at least |
|
Match 0 or more times, but as few times as possible. |
|
Match 1 or more times, but as few times as possible. |
|
Match 0 or 1 time, but as few times as possible. |
|
Match at least |
|
Match at least |
|
Match 0 or more times, and never backtrack. |
|
Match 1 or more times, and never backtrack. |
|
Match 0 or 1 times, and never backtrack. |
|
Match at least |
|
Match at least |
|
Match at least |
|
Match with if-then-else pattern. The
|
|
Match with if-then pattern. The |
18.221.154.18