Hi, @kusalux, and All,
Yeah ! it’s always the same story ! Everyone which codes, or even builds a regex, before writing the first line, should ask himself, about all aspects of the program or the regex to create ;-))
Regarding your analyse about fair dates or wrong ones, an other guy could have a totally different approach about what it’s right or not ! Theoretically, in your case, you should recapitulate all possible valid dates and all possible valid formats of date that you consider as right ones ! I do understand that this is, generally, not an easy task !
For instance, you said that the syntax 10.11.12. should be taken as valid. But, now, the syntax 10.11.12.13 looks rather like an IP address ! And if your last example it.10.11.12 is supposed correct, too, then a date, embedded in text, like , for instance, abc.27.06.12.def should be a valid format of date !
Of course, when building the regexes, in my previous post, I just imagined them, according to my way of considering correct formats of date and how the should be located among all surrounding text ! Now, let’s imagine that you previously thought and defined the list of all valid formats of date ( for YOU ! ) then, half work would be already done and, to get the right regex should be easier to achieve :-))
In addition, you may have a different look to the date problem, later, working on different files ! Indeed, regexes strongly depends on the current file contents, which could end to very different regexes for similar kinds of search ! And, honestly, when a regex seems too specific or complicated, and can be used in very few cases, only, I rather think that it’s not a useful regex, anyway :-))
If you do need information on regexes, I could help you, but I’m sure than you can cope with these strange things ( the regexes ) by yourself :-))
Cheers,
guy038
P.S. :
Above all, I forgot to point out, that a script or a programming language is a better way to verify dates than regexes, anyway !