jxbma
asked on
What is the regex expression for validating year in the YYYY format?
Hi:
I've got pretty limited experience dealing with regex expressions.
I'm looking for a regex expression to validate the following: Valid Year in the form YYYY.
We want to check for years in the 1000's through to the 2000's.
I came up with something like this:
But I think there must be something a little cleaner/more elegant.
Thanks,
JohnB
I've got pretty limited experience dealing with regex expressions.
I'm looking for a regex expression to validate the following: Valid Year in the form YYYY.
We want to check for years in the 1000's through to the 2000's.
I came up with something like this:
^(15|16|17|18|19|20)\d\d
This would work for years from 1500 - 2099But I think there must be something a little cleaner/more elegant.
Thanks,
JohnB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
JB