W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2002

RE: Regular Expressions in XQuery/XPath2

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 17 Oct 2002 03:13:44 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DC8B@daemsg02.software-ag.de>
To: Jennifer Schachter <jas@decisionsoft.com>, public-qt-comments@w3c.org

> In section 6.3.15.1 of the F&O spec, it says that:
> 
> "In string mode, the meta-character . matches any character 
> whatsoever. In 
> multi-line mode, the meta-character . matches any character 
> except a newline 
> character."
> 
> This seems to infer that in string mode, the meta-character . 
> should match the newline character. However, this behaviour 
> would differ from that of Regular Expressions in XML Schemas: 
> in appendix F of the XML Schema Datatypes spec the equivalent 
> character class for . is given as [^\n\r].
> 
> Can you please verify whether a newline should match the . 
> meta-character 
> in string mode? Is the newline character considered 'any character'?

Yes, you have read the spec correctly. 

The decision to diverge from XML Schema, and to instead adopt the Perl
conventions including the use of two different modes, wasn't made lightly.
In XML Schema, regular expressions are used only for performing boolean
tests on a string. In XSLT and perhaps also in XQuery, they will also be
used for more complex operations such as transforming multiple lines of text
into multiple element nodes. Some of the use cases required the us of the
text anchors $ and ^, which aren't supported in XML Schema, working in both
string mode and multi-line mode, and this in turn meant that the meaning of
"." needed to match the Perl definition.

Michael Kay
Received on Wednesday, 16 October 2002 21:13:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:43 UTC