www.delorie.com/gnu/docs/emacs/emacs_99.html   search  
Buy the book!

GNU Emacs Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

K.7 Replacement Commands

Global search-and-replace operations are not needed often in Emacs, 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 finds each occurrence of the pattern and asks you 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 X.3 Controlling Abbrev Expansion).

K.7.1 Unconditional Replacement  Replacing all matches for a string.
K.7.2 Regexp Replacement  Replacing all matches for a regexp.
K.7.3 Replace Commands and Case  How replacements preserve case of letters.
K.7.4 Query Replace  How to use querying.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003