Literals

Any character not a meta-character of the regex syntax is matched literally. This is true for any character, even a space is significant unless you also specify the free form mode modifier. If you need to match literally a meta-character, you can precede it by the backslash (\) meta-character. 

For regex stored in string, you should also be careful about the meta-characters specifics to literal string in the host language. To match a backslash in a regex, you need two backlashes (/\\/) 1.

Meta-character used to match special characters

For convenience, most implementation also define character shorthands for useful control characters:

ShorthandMnemonicASCII codeMatches
\aAlert0x07Ctrl-G, the BEL control character
\bBackspace0x08Ctrl-H, the BS control character. The meaning of this shorthand is usually restricted to character classes. Outside character classes, \b means word-boundaries
\eEscape0x1BCtrl-[, the ESC control character
\fForm feed0x0Cthe FF control character
\nNewline0x0Ausualy the LF control character, except for MacOS systems that match ASCII 0x0C
\r Carriage return0x0Cusualy the CR control character, except for MacOS systems that match ASCII 0x0A
\tTabulation0x09the HT control character
\vVertical tabulation0x0Bthe HT control character
\nnnOctal codeany character represented as an octal value, ie: \012 and \n are equivalent. The number of digit following \ is usually fixed to 3.
\x{nn} or \x{nnn}Hexadecimal codeany character represented as an hexadecimal value, ie: \x0A and \n are equivalent. The number of digit following \x is usually fixed to 2 or 4.
\unnnnUnicode characterany unicode character represented as an hexadecimal value, ie: \x000A and \n are equivalent. The number of digit following \u is usually fixed to 4 (or 8).
\ccharControl characterany control character represented by its corresponding control letter, ie: \cJ and \n are equivalent.
  1. ^ If the regex is written as a literal string of a host language that use backslashes has a meta-character, you need four backslashes ("\\\\").