12 chars · 1 line
5 chars · 1 line
12 chars · 1 line
5 chars · 1 line
Regex named groups
Named groups use (?<name>...) so a capture can be identified by purpose instead of only by position. The matcher displays JavaScript's named groups object next to the normal numbered captures. This tool is free to use. No account or payment is required.
Last updated
A named group is still a capturing group. JavaScript exposes it both in the numbered capture sequence and by name, which can make downstream extraction and replacement logic easier to understand.
first and last label the two captured name parts.
(?<first>[A-Za-z]+) (?<last>[A-Za-z]+)
Ada Lovelacefirst: Ada
last: LovelaceCommon questions
No. Named captures are also available in the normal numbered capture sequence.
JavaScript generally requires group names to be valid and unambiguous; duplicate names may be rejected depending on pattern structure and runtime support.
Yes. JavaScript supports named-group replacement syntax when the pattern defines named captures.
Debugging a specific Regex issue? Browse Regex troubleshooting.