GNU Emacs Manual - Word Search

Go to the first, previous, next, last section, table of contents.

## Word 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 between the 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.

`C-s `RET` C-w words `RET``
  Search for words, ignoring details of punctuation.
`C-r `RET` C-w words `RET``
  Search backward for words, ignoring details of punctuation.

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 section Regular Expression 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. The feature that you can get to them via the incremental search commands exists for historical reasons, and to avoid the need to find suitable key sequences for them.

Go to the first, previous, next, last section, table of contents.