Hi all i need all these possible cases to be valid
123
123.1
123.12
I tried this ^[0-9]*\.[0-9]{2}$ or ^[0-9]*\.[0-9][0-9]$ but does not works can any one help me out. And also before . it should accept a maximum of 6 numeric values
Hi all i need all these possible cases to be valid
123
123.1
123.12
I tried this ^[0-9]*\.[0-9]{2}$ or ^[0-9]*\.[0-9][0-9]$ but does not works can any one help me out. And also before . it should accept a maximum of 6 numeric values
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted May 20, 2011, 12:36 AM EDT
^[0-9]{0,6}(\.[0-9]{1,2})?$
^(\d{0,6})(\.\d{1,2})?$
VulpesRank #55 · 29.2K reputationPosted May 20, 2011, 12:42 AM EDT
^\d{1,6}(\.\d{1,2})?$
EDIT: changed final * to ?
Chaitanya57 reputationPosted May 20, 2011, 12:46 AM EDT
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted May 20, 2011, 12:46 AM EDT
http://regexlib.com/DisplayPatterns.aspx?cattabindex=2&categoryId=3