Xsd pattern constraint - disallow backslash
I have a requirement to disallow backslashes in a given string field defined by an xsd document. However, being as green as me, I am not sure about my knowledge of xsd and / or regex. Here's what I have so far:
<xs:simpleType name="BackslashRestrictedField">
<xs:restriction base="xs:string">
<xs:minLength value="0" />
<xs:pattern value="[^\\]"/> <!-- disallow backslash '\' char ??? -->
</xs:restriction>
</xs:simpleType>
Suggestions?
+1
Swim
source
to share
1 answer
If I'm correct, with this expression, you only allow one character long string and don't accept backslashes. Adding * to the end of your regex should fix this problem.
+1
gizmo
source
to share