Please tell me what regular expression should i use to validate cricket overs in textbox.
like it can be 5.1, 5.2,5.3,5.4,5.5 but it should not contain fraction value greater than .5 ,also the values should be numeric only (float and int)
Thanks
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.
You should use this:
If you also want fractions like
.2instead of0.2, use this:Explained:
Your version,
[0-9]+(\.[0-5])?does not work unfortunately, because, for example/[0-9]+(\.[0-5])?/.test("0.8")yields true.