Hi Josiah,

Glad you like the "neat little tool" !!! It was fun making it because it 
was harder than I thought - with so many initially un-imagined situations. 
Interestingly, it made me realize that what seems like a simple situation 
in life, actually has so many complex unseen or unnoticed 
interdependencies. What we imagine is so clear cut is just our own illusion 
created from a lack of understanding and insight. Who would have thought 
coding could make one philosophize!

I actually put the stackoverflow link 
<https://stackoverflow.com/questions/13194322/php-regex-to-check-date-is-in-yyyy-mm-dd-format>
 
of where I got the regex into a field in the date Macro tiddler. You can 
read over there why it was constructed that way, and how it takes into 
account exceptional leap years:

*Every year divisible by 4 is a leap year, except when it is divisible by 
> 100 unless it is divisible by 400. *
>

There is a better YYYY-MM-DD regex a little below that which validates from 
years 1000 - 9999 but I got *blurry eyed* when trying to figure out the 
correct "match remembering" group for the separators . / - and so used the 
present one. The one I would like to use is in a comment a little further 
down in that stackoverflow post:

^((([1-9]\d{3})\-(0[13578]|1[02])\-(0[1-9]|[12]\d|3[01]))|(((19|[2-9]\d)\d{2
})\-(0[13456789]|1[012])\-(0[1-9]|[12]\d|30))|(([1-9]\d{3})\-02\-(0[1-9]|1\d
|2[0-8]))|(([1-9]\d(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][
26])00))\-02\-29))$

Regards


On Sunday, April 14, 2019 at 5:30:31 PM UTC+7, @TiddlyTweeter wrote:
>
> Hi S.S., I got very intrigued by the regex in this neat little tool of 
> yours! The regext has a couple of issues the are not immediately obvious on 
> accurate matching for dates in February. I've written a new version that is 
> easier to understand. It's also easier to set date ranges in it. I'm 
> testing it at the moment and will post it when I'm sure it works reliably.
>
> Best wishes
> Josiah
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/42758349-a458-4136-ae51-1c4f42ef6175%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to