Go to the previous, next section.

The Backslash Character

The `\' character has one of four different meanings, depending on the context in which you use it and what syntax bits are set (see section Syntax Bits). It can: 1) stand for itself, 2) quote the next character, 3) introduce an operator, or 4) do nothing.

  1. It stands for itself inside a list (see section List Operators ([ ... ] and [^ ... ])) if the syntax bit RE_BACKSLASH_ESCAPE_IN_LISTS is not set. For example, `[\]' would match `\'.

  2. It quotes (makes ordinary, if it's special) the next character when you use it either:

  3. It introduces an operator when followed by certain ordinary characters--sometimes only when certain syntax bits are set. See the cases RE_BK_PLUS_QM, RE_NO_BK_BRACES, RE_NO_BK_VAR, RE_NO_BK_PARENS, RE_NO_BK_REF in section Syntax Bits. Also:

  4. In all other cases, Regex ignores `\'. For example, `\n' matches `n'.

Go to the previous, next section.