Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Regular Expressions
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 29th, 2009, 07: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!
  #2 (permalink)  
Old June 6th, 2011, 09: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}$)
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10: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



All times are GMT -4. The time now is 08:58 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.