How to use:
Enter two JavaScript regular expressions (without the surrounding slashes) and click "Check Equivalence".
The tool will determine if both expressions match exactly the same set of strings.
If they're not equivalent, it will show example strings that demonstrate the difference.
Examples:
a*
and a+
are not equivalent
a|b
and b|a
are equivalent
(ab)+
and ab(ab)*
are equivalent
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