Please try this:
<xs:element name="someString">
<xs:simpleType>
<xs:restriction base="xsd:string">
<xs:pattern value="([\w]*[\.\,\-]?[\w]*[\.\,\-]?[\w]*[\.\,\-]?[\w]*)"/>
<xs:length value="23"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Explanation:
[\w\.\,\-]{0,20}
match a single character present in the list below
Quantifier:
Between 0 and 20 times, as many times as possible, giving back as needed [greedy]
- \w match any word character [a-zA-Z0-9_]
- \. matches the character .literally
- \, matches the character , literally
- \- matches the character - literally
So basically this will match all these
- aabbbcaabbbcaabbbcac,,-
- ,,-aabbbcaabbbcaabbbcac
- dd,aabbbc-aabbbc,aabbbc
The length value="23"
forces that the total string be 23 characters and the regex forces that three characters of the total length be between comma, hyphen and period.