Issues with complex regular expressions in C# and VB .Net

This issue has been resolved in Liquid XML 2012 (v10)

In xsd the whole pattern must match for it to be valid, but with many regex patterns, the pattern only matches part which then returns false.

E.g. With the patern:
         <xs:pattern value="[0-9]{1,8}|([0-9]{9,14}|[0-9]{14,14}\.[0-9]+)([+\-][0-9]{1,4})?"/>

When the value is read from the xml document: "20071029130945-0400"

It matches the first part of the regex, i.e. the first 8 chars "20071029" match against [0-9]{1,8}. But in xsd this is invalid as the length of the match is not the same as the length of the whole string.

As a work around, you can simply add "$" to the end of the pattern and the whole string should match.

See Also: