Generate a valid example value for a xs:pattern
I have the following xsd restriction:
<xs:restriction base="xs:string">
<xs:minLength value="25"/>
<xs:maxLength value="26"/>
<xs:pattern value="(SA|DA|NT|DCS)(((0[1-9]|1[0-9])9999999999\d{4}\d{7})|([2-3]0(0[1-9]|[1-4][0-9]|5[0-2])\d{8}\d{4}\d{7})|(4099999999(0[1-9]|1[0-9])\d{4}\d{7}))"/>
</xs:restriction>
The problem is that im not able to generate an example value that complies with this pattern...is there some program or website where inputting the pattern it gives out valid example values for the pattern?
I used liquid开发者_运维知识库 xml studio in order to generate a sample xml with the schema and it got wrong all the strings that were validated by patterns...
OK, because you asked for it:
- http://msdn.microsoft.com/en-us/library/aa833197.aspx
- http://code.google.com/p/xeger/
You could try any regular expression tool such as the ones foound here Free alternative to RegexBuddy
I think you are missing a bracket (EDIT Oh I copied it wrong, now updated to show your expression:-))
(SA|DA|NT|DCS)(((0[1-9]|1[0-9])9999999999\d{4}\d{7})|([2-3]0(0[1-9]|[1-4][0-9]|5[0-2])\d{8}\d{4}\d{7})|(4099999999(0[1-9]|1[0-9])\d{4}\d{7}))
Here are a few matches to get you started
SA11999999999944447777777
DA01999999999944447777777
NT20498888888844447777777
Try Expresso, it will help you. It doesn't generate the expressions, but it explains in plain English what is required.
精彩评论