Here is a complicated regexp, used by Emacs to recognize the end of a
sentence together with any whitespace that follows. It is the value of
the variable sentence-end
.
First, we show the regexp as a string in Lisp syntax to distinguish spaces from tab characters. The string constant begins and ends with a double-quote. `\"' stands for a double-quote as part of the string, `\\' for a backslash as part of the string, `\t' for a tab and `\n' for a newline.
"[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*"
In contrast, if you evaluate the variable sentence-end
, you
will see the following:
sentence-end => "[.?!][]\"')}]*\\($\\| $\\| \\| \\)[ ]*"
In this output, tab and newline appear as themselves.
This regular expression contains four parts in succession and can be deciphered as follows:
[.?!]
[]\"')}]*
\"
is Lisp syntax for a double-quote in
a string. The `*' at the end indicates that the immediately
preceding regular expression (a character alternative, in this case) may be
repeated zero or more times.
\\($\\| $\\|\t\\| \\)
[ \t\n]*
Go to the first, previous, next, last section, table of contents.