Summary: I have added a link to a simple replacement routine I wrote, replace-in-buffer. It replaces text in the complete buffer, with the current region or next word as a pattern for the old string.
> * [[Replace-in-buffer]] -- Replace text in complete buffer, use current region or next word as pattern
Emacs can search in the current buffer, across many buffers or in files.
This page is about searching and replacing text in Emacs. Look for
‘search’ in the EmacsManual for more information – that will also provide info about replacing.
‘M-x occur’and family. Like GrepMode, but for buffers, not files.
‘icicle-search’and completion for Isearch:
‘isearch’string (Emacs 22).
‘M-x anything-query-replace-regexp’: narrow the matched lines by multiple patterns and replace.
You can also, of course, visit files to be searched in buffers, and then use the techniques above for SearchInBuffers.
‘M-x anything-grep’in Lisp:anything-grep.el: narrow the list by multiple patterns
*grep*or any compilation buffer. Multiple levels of regexp search.
‘Q’in Dired) – Mark files, then search and replace in them.
‘M-x grep’– GrepMode
‘M-x tags-query-replace’– replace using etags’ TagFile.
‘M-x anything-grep’in Lisp:anything-grep.el: narrow the list by multiple patterns.
*grep*buffer and replace text within them.