This regular expression
/^\d{1,6}(?:\.\d{0,2})?$/
limits the user to only 6 digits.
- How to make this regex work to allow any number of digits(no max limit)
- How to make this regex optional
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.
Assuming you just mean any number of digits followed by any single character followed by 2 digits, then use:
If 0 is ok, then:
I think you actually are trying to find money values (dollar and cents) which would likely be this instead: