Next: Regexp Search, Previous: Nonincremental Search, Up: Search
Word search searches for a sequence of words without regard to how the words are separated. More precisely, you type a string of many words, using single spaces to separate them, and the string can be found even if there are multiple spaces, newlines, or other punctuation characters between these words.
Word search is useful for editing a printed document made with a text formatter. If you edit while looking at the printed, formatted version, you can't tell where the line breaks are in the source file. With word search, you can search without having to know them.
Word search is a special case of nonincremental search and is invoked with C-s <RET> C-w. This is followed by the search string, which must always be terminated with <RET>. Being nonincremental, this search does not start until the argument is terminated. It works by constructing a regular expression and searching for that; see Regexp Search.
Use C-r <RET> C-w to do backward word search.
Forward and backward word searches are implemented by the commands
word-search-forward
and word-search-backward
. These
commands may be bound to keys in the usual manner. They are available
via the incremental search commands both for historical reasons and
to avoid the need to find suitable key sequences for them.