groupCount property
Returns the number of captured groups in the match.
Some patterns may capture parts of the input that was used to compute the full match. This is the number of captured groups, which is also the maximal allowed argument to the group method.
Implementation
int get groupCount;