RE: Date validating regexp in pattern facet yields invalid results?

> -----Original Message-----
> From: Johann Sijpkes [mailto:jsijpkes@tiscali.nl] 
> Sent: Wednesday, July 14, 2004 12:56 PM
> To: xmlschema-dev@w3.org
> Subject: Date validating regexp in pattern facet yields 
> invalid results?
> 
> 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[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/(\d{2}))|((0[1-9]
> |[12]\d|30)\/(
> 0[13456789]|1[012])\/(\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/(\d{2}
> ))|(29\/02\/((
> 0[48]|[2468][048]|[13579][26])|(00))))$" />
> </xsd:restriction>
> </xsd:simpleType>

Are you sure the shorter one works...because I tried in xerces 2.6 and it didn't work either...and I wouldn't expect it to work.

If you just take out the ^$ anchors in either expression then they work just fine (at least in xerces 2.6.2...the only processor I've checked them against).

For the explanation of why the ^$ anchors are the problem, see errata E2-52 [1], which is also incorpated into the main text of Appendix F in the Proposed 2nd Edition of schema [2].

pvb

[1] http://www.w3.org/2001/05/xmlschema-errata#E2-52
[2] http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/#regexs

Received on Wednesday, 14 July 2004 16:11:26 UTC