Splitting up regex pattern restriction in XSD

Viewed 1820

I have a regex pattern in my XSD that does the trick but the readability is poor.

<xs:element name="short_description">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:pattern value="|^([a-zA-Z0-9áÁâÂàÀäÄåÅöÖòÒóÓôÔøØüÜûÛùÙúÚßíÍïÏîÎìÌñÑÇç.,?()!\/çéÉêÊèÈëË +;&amp;&apos;':&quot;\n\t%#£°€@=«»¦*`´-]){1,}$"/>
                    </xs:restriction>
                </xs:simpleType>
</xs:element>

Therefore I tried to seperate it as the following for a better readability (example)

    <xs:element name="title">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <!-- Check the title with no limitation to size -->
                <xs:pattern value="|^([a-zA-Z0-9áÁâÂàÀäÄåÅöÖòÒóÓôÔøØüÜûÛùÙúÚßíÍïÏîÎìÌñÑÇçéÉêÊèÈëË]){1,}$"/>
                <xs:pattern value="|^([.,?()!\/ +;':`´-]){1,}$"/>
                <xs:pattern value="|^([&amp;$apos;&quot;]){1,}$"/>
                <xs:pattern value="|^([\n\t]){1,}$"/>
                <xs:pattern value="|^([%#£°€@=«»¦*]){1,}$"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

After rerunning my XSD it seems that he is only looking at the first line when the patterns are separated.

Is there a way to make the first pattern (see above) more readable? Or am I doing something wrong in the second example?

3 Answers
Related