Emacs Regex vs Regex in Python, JavaScript, Java
Emacs regular expression is different from the regular expression in JavaScript, Python, etc.
Here are practical major differences.
| JavaScript etc | emacs lisp | |
| Capture | "(capture)" | "\\(capture\\)" |
| digit | "\d" | "[0-9]" or "[[:digit:]]" † |
| word | "\w" | "[_A-Za-z0-9]" or "[[:word:]]" † |
| whitespace | "\s" | "[ \n\t]" or "[[:space:]]" † |
† depends on emacs syntax table. Elisp: Regex Named Character Class and Syntax Table
emacs and elisp regex
- Emacs: Regular Expression
- Emacs: List Matching Lines
- Emacs: Regular Expression Syntax
- Emacs: Regex Backslash in Command Prompt
- Emacs: Case Sensitivity in Text Search Commands
- Emacs: Insert Tab or Newline
- Emacs: Wildcards vs Regular Expression
- Elisp: Regular Expression
- Elisp: Regex Functions
- Elisp: Regex Backslash in Lisp Code
- Elisp: Case Sensitivity (case-fold-search)
- Elisp: Find Replace Text in Buffer
- Elisp: Match Data (Regex Result)
- Elisp: Unicode Escape Sequence
- Elisp: Convert Regex to Lisp Regex String
- Elisp: How to Test Regex
- Elisp: Regular Expression in Lisp Syntax, Rx (Package)
- Elisp: Regex Named Character Class and Syntax Table
- Emacs Regex vs Regex in Python, JavaScript, Java