Regular expression searches are used extensively in GNU Emacs. The two
functions, forward-sentence and forward-paragraph illustrate
these searches well.
Regular expression searches are described in section `Regular Expression Search' in The GNU Emacs Manual, as well as in
section `Regular Expressions' in The GNU Emacs Lisp Reference Manual. In writing this chapter, I am presuming that you have at
least a mild acquaintance with them. The major point to remember is
that regular expressions permit you to search for patterns as well as
for literal strings of characters. For example, the code in
forward-sentence searches for the pattern of possible
characters that could mark the end of a sentence, and moves point to
that spot.
Before looking at the code for the forward-sentence function, it
is worth considering what the pattern that marks the end of a sentence
must be. The pattern is discussed in the next section; following that
is a description of the regular expression search function,
re-search-forward. The forward-sentence function
is described in the section following. Finally, the
forward-paragraph function is described in the last section of
this chapter. forward-paragraph is a complex function that
introduces several new features.
Go to the first, previous, next, last section, table of contents.