2

I have used regular expression for yes no type. but compiler throwing exception like this.

<xsd:simpleType name="YesNoType">
        <xsd:annotation>
            <xsd:documentation>
                Type for yes and no inputs.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
                <xsd:pattern value="(?:Y|N)"/>
        </xsd:restriction>
</xsd:simpleType>

InvalidRegex: Pattern value '(?:Y|N)' is not a valid regular expression. The reported error was: 'This expression is not supported in the current option setting.'.

Please help me regarding this.

Ramkumar
  • 154
  • 5
  • 11
  • I have added this in xsd regular expression validation. – Ramkumar Apr 01 '15 at 05:37
  • 1
    Take a look at XSD part 2, or at any book on XML Schema, for a definition of what regular expressions it allows. You can't assume that all regular expression dialects are the same. – Michael Kay Apr 01 '15 at 10:07

1 Answers1

3

Just replace it with something simpler like

Y|N

Or

[YN] 

Or the like.

Non-capturing parens are not implemented in all versions of regex.

Peter Bowers
  • 3,063
  • 1
  • 10
  • 18