I need to check a value if it is numeric and optionally contains commas.
I tried
var input=3433;
var pattern=/^[1-9]\d{0,2}(\.\d{3})*(,\d+)?$/;
pattern.test(input);
but it always gave me false;
I don't want to use $.isNumeric
as it does not check for commas.
Your sample var input is not matched by your regex because of the dot.
You could do:
This regex will match:
123
1234
1.234
123,45
1234,567
1.234,56
1.234.567,89