What it does
A regex that works in one place but not in your code usually meets a different dialect, different flags or an extra escaping layer.
How to use it
- Select the engine your code uses.
- Load the failing case: JavaScript named-group syntax in Python.
- Load the corrected pattern, then export code for your language.
Verified example
As written
Text "TX-00057"
(?<id>TX-\d{5}) Result: rejected: invalid pattern
Corrected
Text "TX-00057"
(?P<id>TX-\d{5}) Result: "TX-00057"
Recorded by running fixture FX-G03 on : rp.js@1 on Node v24.21.0 (V8), v24.21.0, CPython 3.14.2 (Pyodide 314.0.7), PCRE2 10.48, go1.27.1. JavaScript results come from the rp.js@1 core on Node’s V8; your browser runs the same core.
Engines
- Named groups, lookbehind, flags and replacement templates differ between engines; use Compare to see where.
Limits
- Fixing one syntax difference does not prove the rest of the pattern is compatible.