How to allow only a valid floating point number into a text field
floating point like these only
15
15.41
7045.12
0.74
–only 2 places after the digit
–max one dot
–only positive number so no need for +/-
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
and I bet this has been asked here before…
This regex allows integers or floats with one or two decimal places. The integer part is mandatory.
If your intent is not to validate input strings but to find decimal numbers inside a larger string, use this instead: