count_capture_groups: Count capture groups
Description
Count the number of capture groups in a regular expression.
Usage
count_capture_groups(regex)
Arguments
regex
(character
of length 1)
Value
numeric
of length 1
Source
http://stackoverflow.com/questions/16046620/regex-to-count-the-number-of-capturing-groups-in-a-regex