Apr 29, 2022 · Named capture groups. Instead of relying on the automatic numbering of a capture group, you can give it a name. The syntax for a named capture group is (?subexpression). Named capture groups, like numbered capture groups, can be used within the regular expression itself or in a replacement pattern. To access the named capture group: