+can act. It is poor practice to depend on this behavior; quote the
+special character anyway, regardless of where it appears.@refill
+
+As a @samp{\} is not special inside a character alternative, it can
+never remove the special meaning of @samp{-} or @samp{]}. So you
+should not quote these characters when they have no special meaning
+either. This would not clarify anything, since backslashes can
+legitimately precede these characters where they @emph{have} special
+meaning, as in @samp{[^\]} (@code{"[^\\]"} for Lisp string syntax),
+which matches any single character except a backslash.
+
+In practice, most @samp{]} that occur in regular expressions close a
+character alternative and hence are special. However, occasionally a
+regular expression may try to match a complex pattern of literal
+@samp{[} and @samp{]}. In such situations, it sometimes may be
+necessary to carefully parse the regexp from the start to determine
+which square brackets enclose a character alternative. For example,
+@samp{[^][]]} consists of the complemented character alternative
+@samp{[^][]} (which matches any single character that is not a square
+bracket), followed by a literal @samp{]}.
+
+The exact rules are that at the beginning of a regexp, @samp{[} is
+special and @samp{]} not. This lasts until the first unquoted
+@samp{[}, after which we are in a character alternative; @samp{[} is
+no longer special (except when it starts a character class) but @samp{]}
+is special, unless it immediately follows the special @samp{[} or that
+@samp{[} followed by a @samp{^}. This lasts until the next special
+@samp{]} that does not end a character class. This ends the character
+alternative and restores the ordinary syntax of regular expressions;
+an unquoted @samp{[} is special again and a @samp{]} not.
+
+@node Char Classes
+@subsubsection Character Classes
+@cindex character classes in regexp
+
+ Here is a table of the classes you can use in a character alternative,
+and what they mean:
+
+@table @samp
+@item [:ascii:]
+This matches any @acronym{ASCII} character (codes 0--127).
+@item [:alnum:]
+This matches any letter or digit. (At present, for multibyte
+characters, it matches anything that has word syntax.)
+@item [:alpha:]
+This matches any letter. (At present, for multibyte characters, it
+matches anything that has word syntax.)
+@item [:blank:]
+This matches space and tab only.
+@item [:cntrl:]
+This matches any @acronym{ASCII} control character.
+@item [:digit:]
+This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]}
+matches any digit, as well as @samp{+} and @samp{-}.
+@item [:graph:]
+This matches graphic characters---everything except @acronym{ASCII} control
+characters, space, and the delete character.
+@item [:lower:]
+This matches any lower-case letter, as determined by
+the current case table (@pxref{Case Tables}).
+@item [:multibyte:]
+This matches any multibyte character (@pxref{Text Representations}).
+@item [:nonascii:]
+This matches any non-@acronym{ASCII} character.
+@item [:print:]
+This matches printing characters---everything except @acronym{ASCII} control
+characters and the delete character.
+@item [:punct:]
+This matches any punctuation character. (At present, for multibyte
+characters, it matches anything that has non-word syntax.)
+@item [:space:]
+This matches any character that has whitespace syntax
+(@pxref{Syntax Class Table}).
+@item [:unibyte:]
+This matches any unibyte character (@pxref{Text Representations}).
+@item [:upper:]
+This matches any upper-case letter, as determined by
+the current case table (@pxref{Case Tables}).
+@item [:word:]
+This matches any character that has word syntax (@pxref{Syntax Class
+Table}).
+@item [:xdigit:]
+This matches the hexadecimal digits: @samp{0} through @samp{9}, @samp{a}
+through @samp{f} and @samp{A} through @samp{F}.
+@end table
+
+@node Regexp Backslash
+@subsubsection Backslash Constructs in Regular Expressions