Here's one way to do it. It creates a new array which contains all matches for each line of input:
use warnings; use strict; while (<DATA>){ my @matches; while (/%([^%]+)%/g){ push @matches, $1; } print join ' ', @matches; print "\n"; } __DATA__ <span color="#231f20" textOverprint="false">%PN1%</span> <span color="#231f20" textOverprint="false">%DIMMM%%DIMINCH%</span> __END__ PN1 DIMMM DIMINCH
In reply to Re: Trouble capturing multiple groupings in regex
by stevieb
in thread Trouble capturing multiple groupings in regex
by reverendphil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |