I just had another idea. Depending on the size of your search space, you might be interested in the thread
Regexp generating strings?. In
a reply I gave a program that generates all matching strings for RegExes with certain limitaions. You could extend the program to suit your needs (e.g. add
$regex =~ s/\d/'(' . join('|', ('0' .. '9')) . ')'/eg;) and then calculate the minimal distance from your input to the possible matches.
Hope this helped.
CombatSquirrel.
Entropy is the tendency of everything going to hell.