W3C home > Mailing lists > Public > public-qt-comments@w3.org > January 2011

Re: Back references inside character classes

From: Paul J. Lucas <paul@lucasmail.org>
Date: Sun, 2 Jan 2011 13:21:35 -0800
Cc: public-qt-comments@w3.org
Message-Id: <741FC95F-94C6-4401-B0E6-A0477A15E8EC@lucasmail.org>
To: Michael Kay <mike@saxonica.com>
On Jan 2, 2011, at 11:56 AM, Michael Kay wrote:

> On 02/01/2011 17:01, Paul J. Lucas wrote:
>> The W3C test K2-MatchesFunc-11:
>> 
>> 	matches("abcd", "(asd)[\1]")
>> 
>> tests that an XQuery implementation should raise the FORX0002 error for a back reference inside a character class.  However, after reading:
>> 
>> * XQuery and XPath Functions and Operators, section 7.6.1
>> * XML Schema Part 2, appendix F
>> 
>> I can't find where any specification explicitly forbids it.  Can somebody point me to the section of a specification that does?  Thanks.
>> 
> It's stated twice in section 7.6.1 (http://www.w3.org/TR/xpath-functions/#regex-syntax):
> 
> (a) "Back-references are allowed outside a character class expression."
> 
> (b) Note: Within a character class expression, \ followed by a digit is invalid. Some other regular expression languages interpret this as an octal character reference.

OK, I was looking at the 2007 version of the spec.  I didn't realize there was a Dec 2010 version.

- Paul
Received on Sunday, 2 January 2011 21:22:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:44 UTC