Regex Named Group Converter
Convert regex patterns and replacements between numbered groups and named capture groups with live output.
Convert between named and numbered regex capture groups
Modern JavaScript and PCRE-style engines support named captures such as (?<year>\d{4}) and
replacement tokens like $<year>. Older snippets still use numbered groups (\d{4})
and $1. This converter rewrites patterns and replacement strings in both directions so you can
port expressions between codebases or documentation examples.
How to use this tool
- Select Named groups to numbered or Numbered groups to named.
- Paste the pattern and replacement string.
- When converting to named groups, list capture names in order separated by commas.
- Copy the converted pattern and replacement from the output fields.
Complex patterns with nested groups or lookaround may need manual review after conversion. Test results with the Regex Tester.
Frequently Asked Questions
Does conversion understand non-capturing groups?
Non-capturing constructs such as (?:...) are left unchanged. Only plain ( opens that receive a name when converting to named syntax.
Which replacement syntax is supported?
Named mode recognizes $<name> and \k<name>. Numbered mode uses $1, $2, and similar tokens.
Is data sent to a server?
No. Conversion runs locally in your browser.