manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.3 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 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.

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 as a special case of nonincremental search 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 Regular Expression Search.

Use C-r <RET> C-w to do backward word search.

You can also invoke word search with C-s M-e C-w or C-r M-e C-w followed by the search string and terminated with <RET>, C-s or C-r. This puts word search into incremental mode where you can use all keys available for incremental search. However, when you type more words in incremental word search, it will fail until you type complete words.

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 separate key sequences for them.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2024
Individual documents may contain additional copyright information.