J
Johann Sijpkes
Hi,
Just before going mad I thought asking this newsgroup would be a good idea.
I want to validate dates using a schema but somehow the regexp is not
performed by the validator?
(at w3c..).
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 ?
I have no idea why this is..
Is the expression too long? If so, is there a workaround?
Thanks,
Johann
This is the code:
<xsd:simpleType name="date_type" >
<xsd:restriction base="xsd:string">
<xsd:minLength value="8" />
<xsd:maxLength value="8" />
<xsdattern value="^\d{2,2}/\d{2,2}/\d{2,2}$" /> <!-- This regexp
works, the next does not -->
<xsdattern 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>
<!-- Credits for the regular expression go to Dany Lauener who posted this
on the regexp library
http://www.regexlib.com/REDetails.aspx?regexp_id=488
Regular expressions can be tested at :
http://www.regexlib.com/RETester.aspx
Just before going mad I thought asking this newsgroup would be a good idea.
I want to validate dates using a schema but somehow the regexp is not
performed by the validator?
(at w3c..).
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 ?
I have no idea why this is..
Is the expression too long? If so, is there a workaround?
Thanks,
Johann
This is the code:
<xsd:simpleType name="date_type" >
<xsd:restriction base="xsd:string">
<xsd:minLength value="8" />
<xsd:maxLength value="8" />
<xsdattern value="^\d{2,2}/\d{2,2}/\d{2,2}$" /> <!-- This regexp
works, the next does not -->
<xsdattern 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>
<!-- Credits for the regular expression go to Dany Lauener who posted this
on the regexp library
http://www.regexlib.com/REDetails.aspx?regexp_id=488
Regular expressions can be tested at :
http://www.regexlib.com/RETester.aspx