is for patterns specifying search or replace strings. Also known as regex
or regexp
, the patterns describe strings to match when searching or replacing. Emacs provides extensive support for regex
patterns in many commands. Emacs also provides an interactive expression builder for such patterns.
Written in a declarative language, patterns for matching text use a combination of special characters and ordinary characters. Many Emacs commands can use regular-expressions for searching, matching, replacing, and navigating. Emacs has several methods of entering search patterns, including the interactive re-builder
and alternative syntax styles. Regex versions of search and replace commands can also work incrementally like the query-replace.
Some commands include regex
or regexp
prefixes or suffixes. Common ones are replace-regexp
, query-replace-regexp
, align-regexp
, highlight-regexp
. But not all commands have regexp in their names, such as multi-occur
, how-many
, keep-lines
, flush-lines
, grep
, lgrep
, and rgrep
. Emacs uses regexp patterns extensively.
Questions tagged with regexp or regular-expressions should include additional tags or clarify which command is being used for regex matching.