What's different between Python and Javascript regular expressions?

Question:

Are Python and JavaScript regular expression syntax identical?

If not, then:

  1. What are the important differences between them
  2. Is there a python library that “implements” JavaScript regexps?
Asked By: Dave Peck

||

Answers:

There is a comparison table here:

Regex Flavor Comparison

Answered By: EBGreen

Part 1
They are different; One difference is Python supports Unicode and Javascript doesn’t.

Part 2
Read Mastering Regular Expressions. It gives information on how to identify the back-end engines (DFA vs NFA vs Hybrid) that a regex flavour uses. It gives tons of information on the different regex flavours out there.

There is way too much information to convey on a single SO answer, so you’re better off having a solid piece of reference material on the subject.

Answered By: Gavin Miller
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.