Download Cheat sheet PDF 12 pages · syntax, editors, patterns, Unicode, performance, debugging
Regex flavor converter

Port your regex.

Convert between JavaScript, Python, Java, .NET, Go, Ruby, and PCRE. We translate named groups, backreferences, and anchors — and flag features that don't carry over.

What gets converted

The converter knows about these syntactic differences and translates automatically:

Feature JavaScript Python Java .NET Go Ruby PCRE
Named group (?<n>) (?P<n>) (?<n>) (?<n>) (?P<n>) (?<n>) both
Named backref \k<n> (?P=n) \k<n> \k<n> ✗ none \k<n> both
Lookbehind variable fixed-width bounded variable ✗ none variable variable
Atomic group (?>) 3.11+ N/A
Possessive *+ ++ ?+ 3.11+ N/A
Backreference \1 ✗ none
\A / \z

About each flavor

  • JavaScript — Used in browsers and Node.js. ES2018+ supports variable-width lookbehind, named groups, and the dotall s flag.
  • Python — The stdlib re module. Uses (?P<name>) syntax. Variable-width lookbehind requires the third-party regex package.
  • Javajava.util.regex. Supports atomic groups, possessive quantifiers, and bounded-width lookbehind. Same named-group syntax as JavaScript.
  • .NET / C#System.Text.RegularExpressions. The most feature-rich flavor: variable-width lookbehind, balancing groups (unique to .NET), and supports both (?<n>) and (?'n') syntax.
  • Go (RE2) — Linear-time guarantee, immune to ReDoS, but no backreferences and no lookarounds. Uses Python-style named groups (?P<n>).
  • Ruby (Onigmo) — Variable-width lookbehind, atomic groups, possessive quantifiers. Supports both (?<n>) and (?'n') syntax.
  • PCRE / PHP — The most permissive flavor. Accepts both JavaScript and Python named-group syntax. Supports nearly every advanced feature.

What we flag but don't convert

Some features have no equivalent in the target flavor — we warn you when those appear:

  • Atomic groups (?>...) — Java, .NET, PCRE, Ruby support these. JavaScript and Python <3.11 don't.
  • Possessive quantifiers *+, ++, ?+ — Same support pattern as atomic groups.
  • Variable-width lookbehind — Python's stdlib re and Java require fixed/bounded width. JavaScript, .NET, Ruby, PCRE handle variable width.
  • Backreferences and lookarounds — Not supported in Go's RE2 (a deliberate trade-off for linear-time matching).
  • Conditional patterns (?(1)yes|no) — PCRE and .NET only.

Why is this rare?

Most regex tools only support testing within one flavor. Cross-flavor migration is something developers do constantly (porting code, copying from Stack Overflow, switching languages) but no major tool helps with it. This is one of the gaps regexguide.com exists to fill.