2
![Stack Overflow](http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png)
If you prefer doing it with regex try this
^(24(\.00?)?|(\.00?)?|\.[0-9]+|0?[0-9](\.[0-9]{0,2})?|[0-2][0-3](\.[0-9][0-9]?)?)$
Tested on all the values below
0.0
4.00
.5
.55
4.01
3.99
5.8
2.99
9.00
09.89
09
8.67
24
24.0
23.99
24.00
0.00
0
10.5
4.5
6
1
24.01 // false
20.18
13...