views:

288

answers:

1

I have a requirement to disallow backslash characters in a given string field defined by an xsd document. However, being as green as I am, I am not confident with my xsd and/or regex knowledge. Here is 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  A: 

If I'm right, with this expression, you only allow a string that's one character long and that won't accept backslash. Adding a * at the end of your regexp should fix this issue.

gizmo
DOH! Thanks for your help.
Swim