A single match (re)sets $1 and $2 (and so on).
If you want to match a regular expression multiple times, you need to do something like:
my @matches = /$re/g;
or
while( $line =~ /$re/g ) { say $1 // $2; }
In reply to Re: regex capture groups when using DEFINE predicate
by Corion
in thread regex capture groups when using DEFINE predicate
by unmatched
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |