[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
- From: Michael Kay <mike@saxonica.com>
- To: "Costello, Roger L." <costello@mitre.org>
- Date: Mon, 13 Aug 2018 21:45:12 +0100
I'm not sure why you've modified this from the regex given in the XSD 1.1 spec which is (ignoring whitespace):
-?([1-9][0-9]{3,}|0[0-9]{3})
-(0[1-9]|1[0-2])
-(0[1-9]|[12][0-9]|3[01])
T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))? The XSD version allows years with more than four digits and places different restrictions on the timezone offset.
Your version also seems to have a serious bug in that it only allows the hour to be in the range 01 to 12.
Both of these regular expressions allow any month to have 31 days. For that reason, I'm not sure either of them is particularly useful.
Michael Kay Saxonica
(\-?[0-9]{4}\-(0[1-9]|1[0-2])\-(0[1-9]|[1-2][0-9]|3[0-1])T(0[1-9]|1[0-2]):(0[0-9]|[1-4][0-9]|5[0-9]):(0[0-9]|[1-4][0-9]|5[0-9])(\.[0-9]+)?(([\+\-]1[0-2]:(0[0-9]|[1-4][0-9]|5[0-9]))|Z)?)
|
[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
RSS 2.0 |
|
Atom 0.3 |
|
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|