[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Here's the regex for the xs:dateTime datatype
On Tue, 2018-08-14 at 10:35 +0100, David Carlisle wrote: > I don't fancy > trying to encode the leap year rules as a regex:-) There's a 4KByte regexp for time and date given in the O'Reilly Mastering Regular Expressions book. You could write it much more simply with Perl 6 regular expressions, which use a grammar, but those aren't (as far as i can tell) widely used or supported by libraries in other languages. It still doens't handle leap seconds correctly, i think. > Also this doesn't account for any historic dates around calendar > changes with variant numbers of days in a month. The XSD calendar is "proleptic" and pretends the changes never happened. To get them right you have to know the geographic perspective, because the calendar changes happened at different years in different countries. Since you can't get it right it's best not to try, but to go only as far as is useful, i think. Once the regexp gets even as complex as Roger's, it's goint to be impractical for most users to work out why their input wasn't valid. I like Peter's YYYY-MM-DD attribute It'd be nice to have a standard way to designate something like HTML's default helper text to be shown in form fields; this is different from a default value. Liam -- Liam Quin, https://www.holoweb.net/liam/cv/ Web slave for vintage clipart http://www.fromoldbooks.org/ Available for XML/Document/Information Architecture/ XSL/XQuery/Web/Text Processing/A11Y work & consulting.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|