in reply to Trouble capturing multiple groupings in regex
Usually you do this type of thing because you want to replace the values, which I'd do like:
s{(<[^>]+>)|%([^%]+)%}{ $1 || $replace{$2} // "%$2%" }ge;
To just fetch the names, I'd do:
my @matches = grep defined, $data =~ m{<[^>]+>|%([^%]+)%}g
Avoiding complex constructs that are so easy to get wrong.
- tye
|
|---|