Regex Dialect Transpiler & Compatibility Matrix
Paste a regex or code snippet to compare PCRE, Go RE2, JavaScript, Python, and Rust. See supported rewrites, unsupported syntax, and matching behavior before copying a result.
5-Engine Cross-Dialect Compatibility Matrix
Real-time checks of syntax support and selected safe rewrites across five regex engines.
Syntax Diagnostics & Engine Advisories
No syntax warnings or incompatibility issues found.
Why Go RE2 & Rust Avoid Catastrophic Backtracking
Traditional regex engines (PCRE, JS, Python) use recursive backtracking, making them vulnerable to Regular Expression Denial of Service (ReDoS). Go RE2 and Rust use deterministic finite automata (DFA/NFA) with guaranteed linear execution time.
Zero Catastrophic Backtracking
RE2 matches supported patterns in time proportional to input length, avoiding catastrophic backtracking. Applications still need limits on input and resource use.
Predictable Scaling
Matching work scales with input length. Large inputs still take more time and memory.
Safer User-Provided Filters
RE2 and Rust regex avoid catastrophic backtracking, but services should still cap pattern size, input size, and resource use.
Standardized Named Groups
Uses Go standard syntax (?P<name>...) matching Python and Rust conventions.
Regex Engine Feature & Complexity Comparison
| Feature / Capability | PCRE / PHP | Go RE2 | JavaScript | Python re | Rust regex |
|---|---|---|---|---|---|
Lookahead (?=...) |
✓ Supported | ⛔ Forbidden (ReDoS risk) | ✓ Supported | ✓ Supported | ⛔ Forbidden |
Lookbehind (?<=...) |
✓ Supported | ⛔ Forbidden | ✓ Supported | ✓ Fixed-width | ⛔ Forbidden |
Backreferences \1 |
✓ Supported | ⛔ Forbidden (NP-complete) | ✓ Supported | ✓ Supported | ⛔ Forbidden |
| Named Groups | (?P<n>..) or (?<n>..) |
(?P<n>..) |
(?<n>..) |
(?P<n>..) |
(?P<n>..) |
Atomic Groups (?>...) |
✓ Native | ⛔ Manual rewrite | ⛔ Manual rewrite | ⛔ Manual rewrite | ⛔ Manual rewrite |
Possessive Quantifiers *+, ++ |
✓ Native | ⛔ Manual rewrite | ⛔ Manual rewrite | ⛔ Manual rewrite | ⛔ Manual rewrite |
Recursion (?R) |
✓ Native | ⛔ Unsupported | ⛔ Unsupported | ⛔ Unsupported | ⛔ Unsupported |
| Time Complexity | \(O(2^N)\) Exponential worst-case | \(O(N)\) Guaranteed Linear | \(O(2^N)\) Exponential worst-case | \(O(2^N)\) Exponential worst-case | \(O(N)\) Guaranteed Linear |
Frequently Asked Questions
Why does Go RE2 reject lookahead (?=...) and lookbehind (?<=...)?
RE2 does not support lookaround assertions. The matrix marks these patterns as incompatible so you can rewrite the surrounding matching logic explicitly.
Why are backreferences forbidden in RE2?
Matching regular expressions with backreferences (like \1 or \k<name>) is proven to be NP-complete, requiring exponential worst-case time in backtracking engines. RE2 disallows backreferences to maintain strict linear performance.
How does the transpiler handle atomic groups (?>...) and possessive quantifiers ++?
The transpiler keeps these constructs unchanged and marks targets without support as incompatible. Removing atomic or possessive behavior can change which strings match, so rewrite and test them manually.
Is regex transpilation and test matching performed securely?
Yes. Syntax checks, selected rewrites, the compatibility matrix, and live preview run in your browser. Regex patterns and test strings are not sent to our servers.