Emacs: Find Replace
Interactive Find Replace
Alt+x query-replace
- Interactive find replace.
- Works on text selection, if none, start from cursor position to end of buffer.
Emacs prompts you for the find string and replace string.
Once emacs found a match, press
- y → replace
- n → skip
- ! → do all replacement without asking.
- Enter → exit.
To undo, exit it first, then do undo previous replacements one by one.
Interactive Find Replace Word with Boundary
Ctrl+u Alt+x query-replace
Find Replace All, in One Shot
Alt+x replace-string
- Do find replace, in one shot.
- Works on text selection, if none, start from cursor position to end of buffer.
Find Replace with Word Boundary, in One Shot
you want to change the word “red” to “blue”, but skip words containg “red” such as “redo”.
Ctrl+u Alt+x replace-string
Do find replace, with boundary check.
Find Replace, by Regex Pattern, in Current File
Reference
Emacs Find Replace
- Emacs: Search Text
- Emacs: Find Replace
- Emacs: Find Replace, by Regex
- Emacs: Find Replace and Change Letter Case
- Emacs: Highlight Word, Line
- Emacs: List Matching Lines
- Emacs: Search Text in Directory
- Emacs: Find Replace Text in Directory
- Emacs: Regular Expression
- Emacs Init: isearch Whitespace Regex
- Emacs Init: isearch by Arrow Keys
- Emacs Flaw: isearch Current Word
- Emacs: Search Current Word 📜
- Emacs: Xah Find Replace (xah-find.el) 📦