regnames_count#

Returns the number of distinct names defined in the pattern of the last successful match.

Synopsis#

use re qw(regnames_count);
"ab" =~ /(?<a>a)|(?<b>x)/;
my $n = regnames_count();   # 2

The count is of the names the pattern defines, whether or not their groups matched, so it can be larger than the number of names regnames() returns without its argument.