GNU Emacs Manual - Replace

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

## Replacement Commands

Global search-and-replace operations are not needed as often in Emacs as they are in other editors(2), but they are available. In addition to the simple `M-x replace-string` command which is like that found in most editors, there is a `M-x query-replace` command which asks you, for each occurrence of the pattern, whether to replace it.

The replace commands normally operate on the text from point to the end of the buffer; however, in Transient Mark mode, when the mark is active, they operate on the region. The replace commands all replace one string (or regexp) with one replacement string. It is possible to perform several replacements in parallel using the command `expand-region-abbrevs` (see section Controlling Abbrev Expansion).

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