XSD string pattern independent of leading/trailing space
- by AndiDog
I have a XSD simple type that should match UUIDs:
<simpleType name="UuidT">
<restriction base="string">
<pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" />
</restriction>
</simpleType>
It correctly matches the following content:
<!-- valid -->
<Uuid>12345678-1234-5678-9012-123456789012</Uuid>
But it doesn't match content that contains excess whitespace:
<!-- not valid -->
<Uuid>
2de25a81-b117-4b2a-b910-50f0878884f7
</Uuid>
Sure, I could add \s* to both sides of the regex, but isn't there a simpler solution in XSD?