Emacs can search in the current buffer, across multiple 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.
‘multi-isearch-buffers’. (See the Emacs manual: Other Repeating Search.)
‘multi-occur’. Similar to grep, but for buffers, not files.
‘icicle-search’and completion for Isearch:
visual-regexp-steroidsextension, you can use a modern regexp engine to power
‘occur’for key bindings and their commands.
C-M-%’, using the current search string.
‘M-x replace-regexp’, but with live visual feedback directly in the buffer.
‘M-x anything-query-replace-regexp’: narrow the matched lines by multiple patterns and replace.
‘C-M-RET’to replace the current search hit, the next N search hits, or all remaining search hits. Can limit search-and-replace to search contexts. Similar to Icicles search-and-replace (sexp eval replacement etc.).
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.