Help with XSD field pattern.

Hello everyone,

I need to define a pattern for a field in XSD where it is a string datatype. The total length is 11. It must allow any data which starts with “S” or “s” followed by 10 digits. S and s are optional.

If they are not sending S or s infront of the number. It must allow the number. Here is what I got but I dont know whether its true or not. Can someone help.

<xs:element name=“Sample”>
<xs:restriction base=“xs:string”>
<xs:pattern value="^[Ss]?(\d{10})+$"/>


Hello David,
I never tried doing the field validations in xsd itself(never heard if it can be done that way) but instead if you do it in a branch/sequence step you can use /^[S|s]{1}[1-9]{10}/ pattern.In your case try using ^[S|s]{1}[1-9]{10} (with out slashes)

Thank you,

Thanks Anil for your response.

I have found a link on google,where we can test the pattern and it is correct.