Emacs Regex vs Regex in Python, JavaScript, Java Etc

By Xah Lee. Date: . Last updated: .

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

Here are practical major differences.

Regular Expression
JavaScript,
Python,
Perl,
Java Etc
emacs lisp
(may not be exactly equivalent)
Capture"(capture)""\\(capture\\)"
digit"\d""[0-9]" or "[[:digit:]]"
word"\w""[_A-Za-z0-9]" or "[[:word:]]"
whitespace"\s""[ \n\t]" or "[[:space:]]"

Emacs Regular Expression

Regex in Emacs Lisp

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial

Emacs Tutorial

Quick Start

Font

Split Window

File

Buffer

Find Replace

Copy/Paste

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Special File

Editing Brackets

Org Mode

HTML

Emacs Efficiency

Misc