the '.+' is greedy and takes the digits too. if after the 'to' you have only white spaces, than use '\s+' instead of '.+' (the '.' takes any char while '\s' takes only white spaces).
If you may have non white spaces after the 'to' than try:
while(<>){
print if (/^(\d+).+to.+(\d+)$/i);
print "$1\n";
print "$2\n";
}
Hotshot