date validation regular expression
Posted by Stefan Camilleri on {2008.July.30}
/** Here is some handy regex to validate a date using british locale (dd/mm/yy or dd/mm/yyyy) */
Note, this allows / \ . or – as delimiters {
^(?:(?:0?[1-9])|(?:[1-2]\d)|(?:3[0-1]))[-.\\/](?:(?:0?[1-9])|(?:1[0-2]))[-.\\/](?:(?:\d{3}[1-9])|(?:\d{2}[1-9]\d)|(?:\d[1-9]\d{2})|(?:[1-9]\d{3})|(?:\d{2}))$
}
p.s. this regex has now been superseded with an improved version here
Caxaria said
You always remind me of him, with your regex love
Stefan Camilleri said
Ooooh more RSS
:D:D:D