Alphanumeric Regex Metasymbols

From Augix' Wiki

Jump to: navigation, search

Table 5.7. Alphanumeric Regex Metasymbols

Symbol Atomic Meaning
\0 Yes

Match the null character (ASCII NUL).

\NNN Yes

Match the character given in octal, up to \377.

\n Yes

Match nth previously captured string (decimal).

\a Yes

Match the alarm character (BEL).

\A No

True at the beginning of a string.

\b Yes

Match the backspace character (BS).

\b No

True at word boundary.

\B No

True when not at word boundary.

\cX Yes Match the control character Control-X (\cZ, \c[, etc.).
\C Yes Match one byte (C char) even in utf8 (dangerous).
\d Yes

Match any digit character.

\D Yes

Match any nondigit character.

\e Yes Match the escape character (ASCII ESC, not backslash).
\E --

End case (\L, \U) or metaquote (\Q) translation.

\f Yes

Match the form feed character (FF).

\G No

True at end-of-match position of prior m//g.

\l --

Lowercase the next character only.

\L --

Lowercase till \E.

\n Yes Match the newline character (usually NL, but CR on Macs).
\N{NAME} Yes

Match the named char (\N{greek:Sigma}).

\p{PROP} Yes

Match any character with the named property.

\P{PROP} Yes Match any character without the named property.
\Q --

Quote (de-meta) metacharacters till \E.

\r Yes

Match the return character (usually CR, but NL on Macs).

\s Yes

Match any whitespace character.

\S Yes

Match any nonwhitespace character.

\t Yes

Match the tab character (HT).

\u --

Titlecase next character only.

\U --

Uppercase (not titlecase) till \E.

\w Yes

Match any "word" character (alphanumerics plus "_").

\W Yes

Match any nonword character.

\x{abcd} Yes

Match the character given in hexadecimal.

\X Yes

Match Unicode "combining character sequence" string.

\z No

True at end of string only.

\Z No

True at end of string or before optional newline.

Personal tools