help with matching invalid dates

Are you missing a feature? Request its implementation here.
dizziedazz
Posts: 2
Joined: Thu Feb 24, 2005 7:14 pm

help with matching invalid dates

Post by dizziedazz »

Can someone help me to create a pattern that identifies "Invalid" dates. Eg. 7/412/02 or 10/1902. Correct dates will be in mm/dd/yy(yy)? format.

Thanks
DzDz
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

Since you are using XML Schema you should check the date built in type and see if you can use that:
http://www.w3.org/TR/xmlschema-2/#date

Otherwise you can constrain the string type for instance like below (or you can invent more strict constraints):

Code: Select all


<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d\d/\d\d/\d\d(\d\d)?"/>
</xs:restriction>
</xs:simpleType>
Best Regards,
George
Post Reply