Skip to main content

15 Searching and Replacement

Like other editors, Emacs has commands to search for occurrences of a string. Emacs also has commands to replace occurrences of a string with a different string. There are also commands that do the same thing, but search for patterns instead of fixed strings.

You can also search multiple files under the control of xref (see Identifier Search) or through the Dired A command (see Operating on Files), or ask the grep program to do it (see Grep Searching).

• Incremental Search  Search happens as you type the string.
• Nonincremental Search  Specify entire string and then search.
• Word Search  Search for sequence of words.
• Symbol Search  Search for a source code symbol.
• Regexp Search  Search for match for a regexp.
• Regexps  Syntax of regular expressions.
• Regexp Backslash  Regular expression constructs starting with ‘\’.
• Regexp Example  A complex regular expression explained.
• Lax Search  Search ignores some distinctions among similar characters, like letter-case.
• Replace  Search, and replace some or all matches.
• Other Repeating Search  Operating on all matches for some regexp.
• Search Customizations  Various search customizations.