Regular Expression for matching dd/mm/yyyy format

10 06 2009

(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)[0-9]{2}

I’m not going to try and explain this regular expression as it is very clever and has been only very slightly modified from the one found here http://www.regular-expressions.info/regexbuddy/dateddmmyyyy.html

I have limited mine slightly more to only being allowed to use slashes and changed the end very slightly (although it means the same thing) and that site shows an excellent explanation. I simply want to post this here as I know I will want to use it in the future and I’m less likely to lose a blog post than a post it note 🙂

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: