How to use:
Enter two JavaScript regular expressions (without the surrounding slashes) and click "Check Equivalence".
The tool determines whether the two expression match exactly the same strings.
Otherwise, example strings are shown that match either expression but not both.
Examples:
a|aa
and a{1,2}
are equivalent
a+
matches a subset of a*
^a{0,4}$
and ^a{2,6}$
match some common strings
Supported syntax:
- Quantifiers:
a*
, a+
, a{3,10}
, a?
- Alternation:
a|b
- Character classes:
.
, \w
, [a-zA-Z]
, ...
- Escaping:
\$
, \.
, ...
- (Non-)capturing groups:
(?...)
, (...)
- Positive/negative lookahead:
(?=...)
, (?!...)
Unsupported syntax:
- RegExp flags:
g
, i
, m
, s
, u
, y
- Unicode property escapes:
\p{...}
, \P{...}
- Backreferences:
\1
, \2
, ...
- Lookbehind assertions:
(?<=...)
, (?<!...)
- Word boundary:
\b
, \B
Powered by:
📦 @gruhn/regex-utils
- TypeScript library for regex equivalence, intersection, complement and other utilities