^[1-9]+([0-9]*){0,999}$
//start with 1-9 and continue with 0-9 from 0 to 999 times
//if you pleased with my answer ,please accept it
^[1-9]\d{0,3}|10000$