perl -e 'my $str = "chr1:4777082-4777141"; \ my ($foo) = $str =~ /([0-9]+)/; print "foo is $foo\n";' foo is 1 ... oops, that's not right ... mike$ perl -e 'my $str = "chr1:4777082-4777141"; \ my ($foo) = $str =~ /[:]([0-9]+)/; print "foo is $foo\n";' foo is 4777082 ... correct.