regex-parity · live demo

One regex, two languages. Do they agree?

Type a pattern and some text, or pick an example. Plain JavaScript and plain Python run the pattern as it is. regex-parity runs it in both, exactly as it runs in Java. Everything runs in your browser; Python runs through Pyodide.

Examples

Plain JavaScript

new RegExp(pattern, "gi")

Plain Python

re.finditer(pattern, text, re.I | re.UNICODE)

regex-parity · JavaScript

findAll(pattern, text)

regex-parity · Python

find_all(pattern, text)

Loading Python in your browser (about 10 MB, once)…

What regex-parity matched against

How it works

1. Fold the textLook-alike characters become one form: long s to s, full-width to ASCII, smart quotes to straight ones, every dash to a hyphen. Invisible characters are removed.
2. Match the same wayASCII behaviour for \b, \w, \d, \s and case, in every engine. Patterns that engines read differently, such as lookbehind or $, are refused with a reason.
3. Point at the originalEvery match is mapped back, so its position and text are what the user actually wrote.