[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Here's the regex for the xs:dateTime datatype
- From: "Liam R. E. Quin" <liam@fromoldbooks.org>
- To: David Carlisle <d.p.carlisle@gmail.com>
- Date: Tue, 14 Aug 2018 10:38:27 -0400
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]