in reply to g matching after a single regular match

use strict; use warnings; my @strs = ('1.2.3AAABB,AAB,AA,AAABBB', 'AABB,AAAB,ABBB'); for (@strs) { my @parts = /((?:\d+\.?)+ | A+ | B+)/gx; print "qw(", join (' ', @parts), ")\n"; }

Prints:

qw(1.2.3 AAA BB AA B AA AAA BBB) qw(AA BB AAA B A BBB)

Update: remove "while" sillyness


DWIM is Perl's answer to Gödel