W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2005

regular expressions in xml schema

From: Bryan Rasmussen <brs@itst.dk>
Date: Fri, 11 Mar 2005 14:14:20 +0100
Message-ID: <D45A5694803BE943BA46F9A7262BF83D1236C3@its42.itst.local>
To: xmlschema-dev@w3.org

Hi, I have the following regular expression for an email address,
^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Z
a-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-z
A-Z]{2,6}$

from Gavin Sharp at regexlib
http://www.regexlib.com/REDetails.aspx?regexp_id=295

as in 
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://rep.oio.dk/email"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0"
xmlns:e="http://rep.oio.dk/email"
elementFormDefault="qualified">

	




	<xsd:element name="email" type="e:emailType" />

<xsd:simpleType name="emailType">
<xsd:restriction base="xsd:string">
<xsd:pattern
value="^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Z
a-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-z
A-Z]{2,6}$"/>
</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>

this works fine when ran in XSV, that is it allows email addresses I
expected, and disallows non-email strings, however in msxml's schemaCache
and in XMLSPY professional #3 2004 it won't even accept hello@world.com, now
I can't say I have a clear understanding on constraints of regex usage in
xmlschema so what i would like to know is are schemaCache and XMLSPY
correct? That this regex in xml schema should consider name@address.com type
addresses as incorrect?
If so what is wrong with it?
Received on Friday, 11 March 2005 13:23:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT