I want to make a decimal number that is greater than 0 and less than 1, with at most 3 decimal places. So 0, 0.0004, 0.00, 00.004, are NOT valid. But 0.004 is valid.
I thought this shall be simple but couldn’t get it working.
This is what I came up with: /^0(?:\.)([1-9]{1,3}?$)/g which makes 0.004 invalid but 0.004 is valid.
>Solution :
This regular expression should do the trick
^0\.\d{1,3}$
You can test it here
https://regex101.com/r/IwQsaD/1