in reply to Re^2: regex question
in thread regex question

You can't have a dynamical number of captures in Perl 5, which is why you either need split or a regex with the /g modifier in a while loop.

There are hacks, though:

$_ = "abc*def*ghi"; my @matches; m/(?: ([^*]+) (?{ push @matches, $^N}) \*?)+/x; print join('|', @matches), $/;

But before you use this, read the big fat warning in perlre about how experimental (?{ ... }) is.