This week's book giveaway is in the JavaScript forum. We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line! See this thread for details.

I have to take a floating number as input from a jsp page.
The floating number has following constrains:
1. Before the dot there can be at the max 4 digits and atleast 1 digit
2. One can either enter or leave the dot
3. If one enters the dot after it he/she should also enter atleast 1, upto 3 digits.

So I wrote the following regular expression for it, which goes as an input to a javasript:

/^[0-9]{1,4}(\.[0-9]{1,3})?$/

But it doesn't seem working.
My page takes numbers like 11111,222222 ....
Can any one give me some idea on this please?