Wrox Programmer Forums RegEx Question - Disregard
 Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
 ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
 Welcome to the p2p.wrox.com Forums. You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 .
August 24th, 2006, 09:30 AM
Wrox Author
 Points: 13,255, Level: 49
 Activity: 0%

Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
RegEx Question - Disregard

Hey everyone,
I have been messing with this expression forever; what I am trying to do is determine if a date (year part) is between 1900 and 9999.

This expression will validate any year between 1900 - 1999 and 9000 - 9999

(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|99)\d\d

So, I figured that I would just make a range as such:

(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/]([19-99])\d\d

Which fails when you enter any date between the aforementioned range so, I am suspecting, that the range is only valid for [0-9] so does that mean I am going to have to do a condition for each possible 1000 years?

--Disregard

After I posted this I thought the logic out a bit more and this expression works:
(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/]((19)|([2-9][0-9]))\d\d
"The one language all programmers understand is profanity."
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
"Easy is the path to wisdom for those not blinded by themselves."
===============================================

 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 OffTrackbacks are Off Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post regex mrame XSLT 12 July 25th, 2008 09:37 AM Regex question in Java rangalo Java Basics 2 October 26th, 2006 09:26 AM More regex help Snib Pro PHP 4 December 16th, 2004 09:56 PM Need RegEx help Snib Pro PHP 6 November 16th, 2004 06:59 AM Regex Help boyer99g General .NET 2 October 8th, 2004 05:46 PM

All times are GMT -4. The time now is 04:23 AM.