got match_num function to work for all number between 1 and 9999 except for those not in the original document