Reputation: 769
I wanted to create a Javascript regex, which accepts
123, 123.123, 12.34, 1.324
But should not accept
1246, 1234.45, 1.2364
Upvotes: 0
Views: 1679
Reputation: 9101
Try this one:
/^(0|[1-9]\d?\d?)(\.\d{1,3})?$/
I assume "00" or "01.234" should not be valid. Use the other answers if they should. :)
Upvotes: 0