And of course, the other approach (if you don't have 5.10+) is to just grep away all undefined values:
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $s = 'foo [21a] plus (b23) baz'; ;; my @captures = grep defined, $s =~ m{ (\d+) (a|b) | (a|b) (\d+) }xmsg ; dd \@captures; " [21, "a", "b", 23]
Give a man a fish: <%-{-{-{-<
In reply to Re: Complex regex question
by AnomalousMonk
in thread Complex regex question
by Cody Fendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |