Wrox Programmer Forums
| 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 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
  #1 (permalink)  
Old August 24th, 2006, 09:30 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default 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
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================


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





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