Returns the number of capture groups in the regular expression.
- iOS 4.0+
- macOS 10.7+
- tvOS 9.0+
- watchOS 2.0+
- Mac Catalyst 13.0+Beta
A capture group consists of each possible match within a regular expression. Each capture group can then be used in a replacement template to insert that value into a replacement string.
This value puts a limit on the values of
$n in templates, and it determines the number of ranges in the returned
NSText instances returned in the
An exception will be generated if you attempt to access a result with an index value exceeding