Date of birth regular expression

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
rashi
Forum Newbie
Posts: 1
Joined: Wed Apr 02, 2008 4:20 pm

Date of birth regular expression

Post by rashi »

I have an regular expression which validates date for dd/mm/yyyy format. I want to validate that leap year should have 30 days for month of Feb.
Can this be achieved using regular expression? If yes then how..and if no what other way it could be done..

Many thanks in anticipation.
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: Date of birth regular expression

Post by EverLearning »

I was under the impression that leap year should have 29 days in february, instead of 28. :?
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: Date of birth regular expression

Post by prometheuzz »

rashi wrote:I have an regular expression which validates date for dd/mm/yyyy format. I want to validate that leap year should have 30 days for month of Feb.
Can this be achieved using regular expression? If yes then how..
If it is possible, it would be a truly horrific regex! So don't even try: regex is not the tool for this job!

rashi wrote:and if no what other way it could be done..

Many thanks in anticipation.
By programming it. Preferably in a language you're familiar with...
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Date of birth regular expression

Post by onion2k »

PHP has a checkdate() function for checking if a date is valid.
Post Reply