Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Regular Expression Date Validation

Thread Tools

Regular Expression Date Validation

Paul Keister
Posts: n/a
I'm currently using the following regular expression for U.S. date

\d{1,2}/\d{1,2}/\d{4}| \d{1,2}/\d{1,2}/\d{2}

I could have used


but that would allow the case of a three digit year (I wouldn't sleep at

My question is this: Why is it that when I use the inverse pattern, e.g.

\d{1,2}/\d{1,2}/\d{2}| \d{1,2}/\d{1,2}/\d{4}

that four digit date strings fail validation? I have a feeling this has
something to do with regex evaluation rules, but I can't quite puzzle it

Just curious,

Paul Keister

Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM
Regular Expression Date Validation Ken ASP .Net Web Controls 1 06-27-2003 06:20 PM