Solved

validate input field is 4, 5 or 6 digits

Posted on 2015-01-06
2
61 Views
Last Modified: 2015-01-06
I have the following regular expression:

/^[0-9]{4,5}$/

Open in new window


This validates that an input field only accepts 4 or 5 digits as the input.  I need to change it to accept either 4, 5 or 6 digits now.  

I tried the following:

/^[0-9]{4,5,6}$/

Open in new window


This did not work.

Any help is appreciated.
Thanks.
0
Comment
Question by:-Dman100-
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40534032
/^[0-9]{4,6}$/
0
 

Author Closing Comment

by:-Dman100-
ID: 40534171
Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Regex - wild card search results help! 24 53
Need Regular Expresionin quarter hours 3 36
Parse CSS value with RegEx 2 57
regex code how to filter this sql email combo 3 38
As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now