my ($a, $b) = @_;
return undef unless $a < $b;
$b--;
+ my $d = $b - $a;
my @a = split //, $a;
my @b = split //, $b;
my $out;
while (@b) {
my $aa = shift @a;
my $bb = shift @b;
- if ($aa eq $bb) {
+ if (@b < (length $d) - 1) {
+ $out .= '\\d';
+ } elsif ($aa eq $bb) {
$out .= $aa;
} elsif ($aa < $bb) {
$out .= "[$aa-$bb]";