Search code examples
javascriptregexcurrency

currency regex with decimal


I need help: I want to validate in javascript my currency inputs that are in format:

1 234,78 (so there is space between 1000 and 2 decimals that are possible).

Examples:

50,25
50
1 150
1 150,44
1 000 001
1 000 001,25

Can you help me?

Thanks2


Solution

  • ^(\+|-)?(0|[1-9][0-9]{0,2}( [0-9]{3,3})*)(,[0-9]{1,2})?$