Emacs Regex vs Regex in Python, JavaScript, Java

By Xah Lee. Date: . Last updated: .

Emacs regular expression is different from the regular expression in JavaScript, Python, etc.

Here are practical major differences.

Similar Regular Expressions
JavaScript etcemacs 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