Here is my pattern. I'm trying to allow numbers and a decimal with two places plus an optional comma with three digits.
var pattern = /^[0-9]+(,\d{3})*\.[0-9]{2}$/;
Allow
100,000.12
10,000.12
1,000.12
100.12
10.12
.12 (can't get this to allow... see below)
Don't allow
abcd
1,,000.12
1,00.12
1,000.0
1,000.
1,000
Here is the test. If I add a ? after [0-9] it works here, but it does not work in my MVC 5 View. The modal doesn't open, so MVC doesn't like it.
^[0-9]?+(,\d{3})*\.[0-9]{2}$
https://regex101.com/r/HwLS7q/1
UPDATE 1
Don't allow
000,000.12, 0.12 etc...
Any help is much appreciated! Thanks!