It seems I'm stuck again with a simple regex.
What I'd like:
Allowed:
100
999,0
999,999
999,99Disallowed:
-1
0
999,
999,9999
This is what I have so far:
^[0-9]{1,3}(?:\,[0-9]{1,3})?$
Any tips?
You can use this regex:
/^[1-9]\d{0,2}(?:\,\d{1,3})?$/
RegEx Demo
Main difference from OP's regex is use of [1-9]
which matches digits 1 to 9 before rest of the regex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With