my @foo = split /(?|(A)|(B))/, "1A2B3"; use Data::Dumper; print Dumper \@foo;