Originariamente inviato da Braco
mettila così var re5digit = new RegExp("^([1-31])$");

dà errore già col 4