I am new to regular expressions and i would like to validate user input with javascript.
The user input is a currency, but i want it without the thousands commata.
Valid
"12.34"
"12,34"
"1234,5"
"123"
"123,00"
"12000"
Invalid
"12a34"
"abc"
"12.000,00"
"12,000.00"
I tried the following regex-pattern, but it doesnt work for me. it validates for example "12a34" and i dont know why.
/\d+([\.|\,]\d+)?/
What would be the correct regex-pattern ? Could you explain this step by step ?
Thanks !