ormy @nums = $x =~ /(\S+)/g;
my @nums = split(' ', $x);
Update: Oops, misread. How about
# @nums = ('1', '11', '2', '22', '222', '3', '33'); my @nums = $x =~ /(\d+)/g;
or
# @nums = (['1', '11'], ['2', '22', '222'], ['3', '33']); my @nums = map { [ /(\d+)/g ] } $x =~ /(\S+)/g;
I'm not clear on which one you want.
Update: Ah! Now I understand! How did I miss that?
# @nums = ('2', '22', '222'); my @nums = ($x =~ /\s(\S+)/)[0] =~ /(\d+)/g;
or
# @nums = ('2', '22', '222'); my @nums = (split(' ', $x, 3))[1] =~ /(\d+)/g;
In reply to Re: regex for multiple capture within boundary
by ikegami
in thread regex for multiple capture within boundary
by xafwodahs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |