I’m using the REGEX below to effectively check if a string is a YYYY-MM-DD date.
[0-9]{4}-[0-9]{2}-[0-9]{2}
How do I do the reverse and use a similar REGEX to check a string is NOT a date in this format.
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.
You could use a negative look-ahead to solve this:
Edit: After watching the post by Lucasus I’ve made a new regex to have a more strict validation.
New Regex: