W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2004

Date validating regexp in pattern facet yields invalid results?

From: Johann Sijpkes <jsijpkes@tiscali.nl>
Date: Tue, 13 Jul 2004 23:31:54 +0200
To: xmlschema-dev@w3.org
Message-ID: <40F470EA.32102.EE47B4@localhost>

I want to validate dates using a schema but somehow the regexp used to do this 
is not performed by the validator?

I have a small regular expression which works fine, but the long beast just
validates, also on invalid dates like 35/07/04 (dd/mm/yy). Anyway, in the
online regexp tester it works fine ? (And I believe it is a rather popula regexp to 
validate dates..)
I have no idea why this is.. The other restrictions trigger OK.
Is the expression too long? If so, is there a workaround?


This is the code:

<xsd:simpleType name="date_type" >
<xsd:restriction base="xsd:string">
<xsd:minLength value="8" />
<xsd:maxLength value="8" />
<xsd:pattern value="^\d{2,2}/\d{2,2}/\d{2,2}$" /> <!-- This regexp
works, the next does not -->

<xsd:pattern value=
0[48]|[2468][048]|[13579][26])|(00))))$" />

<!-- Credits for the regular expression go to Dany Lauener who posted this
on the regexp library

Regular expressions can be tested at :

The test file is available at 

Thanks again,
Received on Wednesday, 14 July 2004 15:56:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:05 UTC