Emacs Lisp: Tip: Convert Regex to Lisp Regex String
Use emacs to Convert Regex to Elisp Regex String
There is a easy way to get the backslashes right.
- First, Alt + x
list-matching-lines
and enter a regex. - Immediately do Alt + x
repeat-complex-command
.
The elisp string regex syntax will be shown in minibuffer. (with all correct backslashes if needed)

list-matching-lines
, followed by
Alt + x repeat-complex-command
Emacs Regular Expression
- Regular Expression
- Regex Syntax
- About Quoting Regex
- Case Sensitivity
- How to Insert a Tab or Newline
- Wildcards vs Regex
- Emacs Regex vs Python, JavaScript, Java