Previous: Accessing Matched Text Using Match Data, Up: Searching and Replacing [Index]
For interactive development of regular expressions, you can use the ‘M-x re-builder’ command. It provides a convenient interface for creating regular expressions, by giving immediate visual feedback in a separate buffer. As you edit the regexp, all its matches in the target buffer are highlighted. Each parenthesized sub-expression of the regexp is shown in a distinct face, which makes it easier to verify even very complex regexps.
Construct a regexp interactively.
This command makes the current buffer the "target" buffer of the regexp builder. It displays a buffer named "RE-Builder" in another window, initially containing an empty regexp.
As you edit the regexp in the "RE-Builder" buffer, the matching parts of the target buffer will be highlighted.