RegEx Date Mask

The other day I searched for a hour and a half tp find a simple regular expression the would validate a date field with a mask of either mm/dd/yyyy or m/d/yyyy to no avail. All I could find were expressions that either were a mile in length or for some-reason-or-another wouldn’t work with my Coldfusion app. I just needed something super simple, so after a little reading I wrote my own. And so I won’t have to go hunting for this guy again, here is what I can up with:

(0[1-9]|[1-9]|1[012])[- /.](0[1-9]|[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*