Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegEx Required 1

Status
Not open for further replies.

vicvirk

Programmer
Feb 4, 2009
636
CA
I need a regex to mimic the "print pages" option you get int the print dialog box on windows. Each "page" must be exactly 3 digits long and can be a single page or a range of pages (I already have a check in place to ensure the range is valid).

Pages do not need to be in any order (except for ranges), and can be repeated.

Valid Entries
001,002,003-006
001-005,010,011-015,004
001,001,002-006,008-009,050,145

Invalid Entries
001, 002,003-006 (no spaces allowed)
001-5,010,011-015,004 (all pages must be three digits long)
001,001,002-006,008-009.050,145 (only numbers, (0-9), commas and dashes allowed

Can someone help?



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Just like that...thanks!



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top