Possible Duplicate:
Regex for floating point?
I am trying to use the regex.
The valid strings are:
1
11
5
12222222233
1.2
.5
1222.33444
12234.456
0
Invalid Strings are
.
-2
san
2s2
S2S
ssss2ssss
25535535TY
But this regex does not qualify to test multiple dots (.)
such as
1……5,
5..2233
1223…5
This accepts these values as valid string.
Please help me how to fix this issue with reg.
Note, the above validation should be passed.
How about that regex:
\d*(\.\d+)?EDIT
This regex
\d*(\.\d+)?will allow empty values too.The updated version:
\d*(\.)?\d+does not have that issue.Please note that negative values will not be allowed as
\dmatches only digits 0..9