$_ = 'ABcde123D';
if (/([a-z]+)(\d+)/) {
print "\$1:$1,\$2:$2,\$`:$`,\$&:$&,\$':$'\n";
print "entie match $&:start position,$-[0]; end position,$+[0]\n";
print "first group $1:start position,$-[1]; end position,$+[1]\n";
print "second group $2:start position,$-[2]; end position,$+[2]\n";
}
else{
print 'not find';
}
输出:
$1:cde,$2:123,$`:AB,$&:cde123,$':D
first group cde123:start position,2; end position,8
first group cde:start position,2; end position,5
second group 123:start position,5; end position,8