Regex for invalid date formats
Thread poster: Sakkko

Sakkko
Portugal
Nov 28, 2017

I've been trying to build a regex that allows me to verify if there's any invalid date formats on my translation - so far, after knudging a bunch of sphagetti code together, I have what it looks like something that checks if the date format is CORRECT. I want the opposite.
Here's my regex :

^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$


I'm completely lost right now in the midst of this mess. How can I make it so that it is easy for me to search for invalid date formats in my document? Should I just leave it this way and basically see if it detects all dates on my file (if there's any missing, it means they're in a wrong format) ?

Any help is greatly appreciated!


 

Nora Diaz  Identity Verified
Mexico
Local time: 21:24
Member (2002)
English to Spanish
+ ...
What is the correct format? Nov 28, 2017

Hi Sakko,

That's a long expression! What is the correct date format you need?


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Regex for invalid date formats

Advanced search







PerfectIt consistency checker
Faster Checking, Greater Accuracy

PerfectIt helps deliver error-free documents. It improves consistency, ensures quality and helps to enforce style guides. It’s a powerful tool for pro users, and comes with the assurance of a 30-day money back guarantee.

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search