Question topic: regular expression capture group. A regular expression capture group is a portion of a regular expression enclosed in parentheses, which can be used to match a specific set of characters.
Overview
A regular expression capture group is a portion of a regular expression enclosed in parentheses, which can be used to match a specific set of characters.
The matched characters can be accessed later in the program, for example to extract a specific piece of information from a string or to replace the matched characters with new text.
Capture groups are numbered starting from 1, and can be accessed in the program using the group() or groups() methods of a match object.
Capture groups are a special case of non-capturing groups, where grouping is needed, but not separate capturing.