Regex age verification
Posted
by KevinDeus
on Stack Overflow
See other posts from Stack Overflow
or by KevinDeus
Published on 2010-06-10T16:52:51Z
Indexed on
2010/06/10
17:12 UTC
Read the original article
Hit count: 372
Anyone have a good regex for Age verification?
I have a date field where I am validating that what the user enters is a date.
basically I wanted to figure out if that date is valid, and then further refine the date to be within x number of years
Perhaps this may be too complicated to tack onto whatever I have too far, but I figured it wouldn't be.
^([1][012]|[0]?[1-9])[/-]([3][01]|[12]\d|[0]?[1-9])[/-](\d{4}|\d{2})$
© Stack Overflow or respective owner