Regular expression for date

I was looking for the perfect regex to validate a date.

The examples I found on the internet where all not good enough. If you try validating 29/02/2010 it should give a fault but it didn’t so I created my own regex.

The best regular expression I can think of right now is this:


This will allow al dates like 01/01/2010 but will deal with the special ones like 29/02/2010

Leave a Reply

Your email address will not be published. Required fields are marked *