|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] regular expression question
<xsd:simpleType name="emailType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[\p{L}_-]+(\.[\p{L}_-]+)*@[\p{L}_]+(\.[\p{L}_]+)+"/> </xsd:restriction> </xsd:simpleType> Following tools do not throw an error: XML Spy, Stylus Studio, Oxygen. On the other hand: Saxon8SA and IPSI-XQ do. If the definition is changed to <xsd:simpleType name="emailType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[\p{L}_\-]+(\.[\p{L}_\-]+)*@[\p{L}_]+(\.[\p{L}_]+)+"/> </xsd:restriction> </xsd:simpleType> Saxon8SA and IPSI-XQ do not complain anymore. I think the rationale is that the hyphen "-" has within the square brackets (to define character classes) a special meaning and needs to be escaped. But to my surprise the same regular expression is accepted by a dedicated regular expression engine (RegExBuddy), who clearly indicates that it is the character itself we are after. The rationale here could be that since no other character is following the hyphen is not used for indication ranges in character classes, but as itself. Which interpretation is the correct one? Thanks, Paul
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||






