I'm trying to restrict an attribute element of a schema to be between 3 and 20 characters long, but I'm getting an error saying my RegEx is invalid:
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-Z]{3,20}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
Any idea what I'm doing incorrectly here? Specific error is "Range end code point is less than the start end code point"
a-Z
is the invalid range, you should use the lowercase z
instead a-z
<xs:pattern value="[A-Za-z]{3,20}" />
Note that a
ascii value is 97 and Z
is 90 so you were actually defining an interval from 97 to 90 => end-point code is lower than the start-point code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With