Emacs can search in the current buffer, across many buffers or in files.
You can also search Emacs internals--like documentation, commands and variables (See SelfDocumentation). Some completion features use search.
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.
Vanilla:
‘isearch’. ‘C-s’ and ‘C-M-s’.‘M-x occur’ and family. Like GrepMode, but for buffers, not files.Additional:
‘icicle-search’ and completion for Isearch:‘dired-mark-files-containing-regexp’ followed by ‘dired-do-query-replace-regexp’.Vanilla:
‘isearch’ string (Emacs 22).Additional:
‘M-x anything-regexp’, ‘M-x anything-query-replace-regexp’: narrow the matched lines by multiple patterns and replace.‘query-replace’ command.You can also, of course, visit files to be searched in buffers, and then use the techniques above for SearchInBuffers.
Vanilla:
‘M-x grep’‘M-x find-name-dired’‘grep-find’, ‘find-grep-dired’Additional:
‘M-x anything-grep’ in Lisp:anything-grep.el: narrow the list by multiple patterns‘grep’ enhancements*grep* or any compilation buffer. Multiple levels of regexp search.Vanilla:
‘Q’ in Dired) – Mark files, then search and replace in them.‘M-x find-name-dired’‘M-x grep’ – GrepMode‘grep-find’, ‘find-grep-dired’‘M-x tags-query-replace’ – replace using etags’ TagFile.Additional:
‘M-x anything-grep’ in Lisp:anything-grep.el: narrow the list by multiple patterns.*grep* buffer and replace text within them.‘Q’.