I am trying to capture a conditional of years in RegEx. Basically, if they implement just a two digit year, I want to make it a four digit year. So if they put :
1/2/08
I want to make it :
1/2/2008
Any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One [pretty nasty] way using regex:
Wouldn’t it be better to just parse the string into a date object, though? Then you can treat it as a date properly! 🙂