W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2002

[AndrewWatt2000@aol.com] Internationalising Regular Expressions

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 01 Nov 2002 09:24:31 +0000
To: www-xml-schema-comments@w3.org
Message-ID: <f5badkt1w34.fsf@erasmus.inf.ed.ac.uk>

attached mail follows:

This question arises, in part, out of thinking how XForms may handle derived 
datatypes. As the likely audience of English language based Web sites widens, 
capturing and validating text data entered in forms, including XForms, 
becomes a little more complex.

XForms uses the W3C XML Schema <xsd:pattern> element to provide derivation by 

Suppose, in English, we want to limit characters to "word characters" we 
might write something like,
<xsd:pattern value="[A-Za-z0-9_]" />

In JavaScript, for example, I might write [A-Za-z0-9_]  more succinctly as 

However, if I understand Appendix F.1.1 of W3C XML Schema Part 2 the \w 
metacharacter now covers Unicode [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}].

So, <xsd:pattern value="\w" /> would match many (unwanted) characters that <
xsd:pattern value="[A-Za-z0-9_] /> would reject as non-matching. Correct?

A couple of other questions arising from this tentative understanding.

In W3C XML Schema, and therefore in XForms, is it correct that the only way 
to express the notion of an English language / ASCII "word character" in a 
regular expression is using [A-Za-z0-9_]? Or, in other words, is there a 
metacharacter which corresponds to the JavaScript use of \w?

Is there any facility to express the notion of, for example, a French word 
character? Or German? Or is the \p{Basic_Latin} the smallest / most precise 
"chunk" of characters that can be used in such a setting?

Andrew Watt

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Friday, 1 November 2002 04:24:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:59 UTC