Using PHP and/or Perl (although I would prefer a PHP-only solution) I would like to recognize that a given Perl-formatted regex pattern has nested capture groups within it.
Given this pattern:
I would like a function to evaluate as true since it has nested capture groups.
However this pattern:
Would evaluate as false since it does not have nested capture groups (the ?: denotes a non-capturing group).
Note that other constructs that are within ( ) such as flags (?i-m:), lookaheads, lookbehinds, etc. but they should not be considered as true for the purposes of this function, it should only evaluate true for nested capture groups.
Consider that named capture groups in the PHP format of (?P<name>) may exist and would be considered capture groups, evaluating true if nested within another capture group.