I am doing amount validation. The requirements are:
- There should not be a leading zero.
- It should accept only numbers.
- There should be a single decimal point.
- it should accept 9 digits before decimal and 2 digits after decimal.
I have tried this regex:
/^(([1-9]\d{0,8})(\.\d{1,2})?)/g;
The issue is, after entering 9 digits, decimal is getting entered only if you enter any digits along with it simultaneously (at a time), without it I am unable enter decimal point.
123.as valid input\d{0,2}should allow that.