This regex should work:
^[1-9]\d{0,2}(?:,\d{1,3})?$
Here is an explanation:
^[1-9] : it must begin with a number from 1 to 9
\d{0,2} : followed by a minimum of 0, a maximum of 2 digits (0-9)
(?:, : after the decimal point
\d{1,3})? : IF there is a comma, it should be followed by one to three digits
$ : End of line
EXAMPLE
Thanks @ dev-null for this link: Explanation
Michel antoine
source share