% perl -le'print shift=~/\d{5}$/?"OK":"KO"' abcd1234 KO % perl -le'print shift=~/\d{5}$/?"OK":"KO"' abcd12345 OK