Solved

validate input field is 4, 5 or 6 digits

Posted on 2015-01-06
2
62 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with regular expressions query 39 75
Clean URL from GET variables 2 101
Greater than or equal to 2005? 3 45
Regex - Ignoring Spaces 7 26
by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
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…

776 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