Go backward to Collating Elements vs. Characters.
Go up to Regular Expression Syntax.
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 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 List Operators.) 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:
* outside a list,(1) or
* inside a list and the syntax bit
`RE_BACKSLASH_ESCAPE_IN_LISTS' is set.
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 See Syntax Bits. Also:
* `\b' represents the match-word-boundary operator (
see Match-word-boundary Operator.).
* `\B' represents the match-within-word operator (
see Match-within-word Operator.).
* `\<' represents the match-beginning-of-word operator
(see Match-beginning-of-word Operator.).
* `\>' represents the match-end-of-word operator (
see Match-end-of-word Operator.).
* `\w' represents the match-word-constituent operator (
see Match-word-constituent Operator.).
* `\W' represents the match-non-word-constituent operator
(see Match-non-word-constituent Operator.).
* `\`' represents the match-beginning-of-buffer operator and
`\'' represents the match-end-of-buffer operator (
see Buffer Operators.).
* If Regex was compiled with the C preprocessor symbol `emacs'
defined, then `\sCLASS' represents the match-syntactic-class
operator and `\SCLASS' represents the
match-not-syntactic-class operator (*note Syntactic Class
Operators::.).
4. In all other cases, Regex ignores `\'. For example, `\n' matches
`n'.
---------- Footnotes ----------
(1) Sometimes you don't have to explicitly quote special characters
to make them ordinary. For instance, most characters lose any special
meaning inside a list (see List Operators.). In addition, if the
syntax bits `RE_CONTEXT_INVALID_OPS' and `RE_CONTEXT_INDEP_OPS' aren't
set, then (for historical reasons) the matcher considers special
characters ordinary if they are in contexts where the operations they
represent make no sense; for example, then the match-zero-or-more
operator (represented by `*') matches itself in the regular expression
`*foo' because there is no preceding expression on which it can
operate. It is poor practice, however, to depend on this behavior; if
you want a special character to be ordinary outside a list, it's better
to always quote it, regardless.