I'm trying to validate a restricted string using a regular expression ...
<xs:simpleType name="myStringType">
<xs:restriction base="xs:string">
<xs:pattern value="^urn:mystuff:v1:(ABC\.(?!Acme).\S+\.\S+\.a\d+\.v\d+|ABC\.Acme\.\S+\.a\d+\.\d+\.\d+)$"/>
</xs:restriction>
</xs:simpleType>
As you can see the regular expression I'm trying to use is
^urn:mystuff:v1:(ABC\.(?!Acme).\S+\.\S+\.a\d+\.v\d+|ABC\.Acme\.\S+\.a\d+\.\d+\.\d+)$
I would like the following to validate:
urn:mystuff:v1:ABC.Test.MyData.a1.v1
urn:mystuff:v1:ABC.Acme.MyData.a1.0.1
But I would like the following to fail
urn:mystuff:v1:ABC.Acme.MyData.a1.v1
This appears to work fine in an online regex tester but when I use Oxygen XML Editor I get the following error.
Pattern value '^urn:mystuff:v1:(ABC\.(?!Acme).\S+\.\S+\.a\d+\.v\d+|ABC\.Acme\.\S+\.a\d+\.\d+\.\d+)$' is not a valid regular expression. The reported error was: 'This expression is not supported in the current option setting.'.
This post suggests that lookaheads and lookbehinds are not supported in XSD regex but the question relates to number patterns so a brute force approach is taken in the example. This is possible because there's a very limited subset of possibilities.
How does one deal with this when the values to be disallowed is a specific string?