Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Regular Expressions
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Regular Expressions
This is the forum to discuss the Wrox book Beginning Regular Expressions by Andrew Watt; ISBN: 9780764574894
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Regular Expressions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2009, 06:18 AM
Registered User
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me out for user input ranges from--

Hi am new to regex am in a need of regex for input from

ranges from 1 to 6999 accepting -and space in bettween them.

ex: 1-6999 (true- validation)
6999-6999(true- validation)
6999 6999(true- validation)
6999 (true- validation)
0 (false- validation)
1-7000(flase- validation)

i have written an regex :^([1-9]\d{0,2}|[1-6]\d{0,3})?[- ]?([1-9]\d{0,2}|[1-6]\d{0,3})$

but its not working can any one help me!

Thanks in advance!
 
Old June 6th, 2011, 08:19 AM
Authorized User
 
Join Date: Mar 2011
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vijay1253 View Post
Hi am new to regex am in a need of regex for input from

ranges from 1 to 6999 accepting -and space in bettween them.

ex: 1-6999 (true- validation)
6999-6999(true- validation)
6999 6999(true- validation)
6999 (true- validation)
0 (false- validation)
1-7000(flase- validation)

i have written an regex :^([1-9]\d{0,2}|[1-6]\d{0,3})?[- ]?([1-9]\d{0,2}|[1-6]\d{0,3})$

but its not working can any one help me!

Thanks in advance!
This is the regex to meet your req
Quote:
^([1-6][0-9]{0,3})[- ]([1-6][0-9]{0,3}$)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Encoding User Input tectrix BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 February 6th, 2008 06:58 AM
storing user input brainchild Javascript 2 March 1st, 2007 04:55 AM
Displaying user input macrocosm Beginning PHP 3 June 15th, 2006 09:30 PM
checking user input hosefo81 Javascript How-To 0 February 16th, 2004 11:59 PM
Validating user input stu9820 VB.NET 2002/2003 Basics 2 January 15th, 2004 12:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.