Test (?<name>…) patterns · Extract labeled values · Replace with $<name> — free, no signup
Named capture groups let you label parts of a regex pattern and retrieve them by name instead of index. Test them live with our online regex tester — group values appear labeled in the match panel.
Test named capture groups right now — paste your pattern and see each group extracted by name.
Open the Regex Tester →A named capture group uses (?<name>…). The name must start with a letter and contain only letters, digits, or underscores. You can have multiple named groups in the same pattern.
In Replace mode, use $<name> to reference the group:
With the g flag, iterate with matchAll():
A named capture group assigns a label to a capturing group using (?<name>…). Values are accessible via match.groups.name instead of by index. This makes patterns more readable and refactoring safer.
Yes. Named capture groups were introduced in ES2018 and are supported in all modern browsers (Chrome 64+, Firefox 78+, Safari 11.1+, Edge 79+).
In ECMAScript 2025+, duplicate named groups are allowed in alternations ((?<x>a)|(?<x>b)). In older engines this throws a SyntaxError, so avoid duplicates for broad compatibility.
String.prototype.replaceAll() with a regex requires the g flag. The replacement string syntax is the same: $<name>. You can also pass a function as the second argument and access match.groups in it.