This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16809 - [FO3.0] '$' in regular expressions
Summary: [FO3.0] '$' in regular expressions
Status: RESOLVED WORKSFORME
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-20 17:01 UTC by Michael Kay
Modified: 2012-05-15 15:58 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2012-04-20 17:01:40 UTC
In bug #4543 we decided that in multiline mode, a trailing newline should be disregarded when considering whether we are at the end of the string for the purpose of matching '$'. However, there was no suggestion that a trailing newline should be disregarded when not in multiline mode.

However, it appears that some popular regex engines do interpret '$' in this way. As evidence, the XSLT 2.0 test case regex02 expects '$' to match in these circumstances, and in several years the test case has not been challenged.

A new test case has been added to QT3 to help resolve the question. fn-matches-47 does this query

fn:matches(concat('abcd', codepoints-to-string(10), 'defg', codepoints-to-string(10)), "g$")

and the answer is clearly false given the spec as currently written. It is reported in email that XmlPrime returns false, while DB2 LUW 9.7 returns true. Saxon 9.4 also returns true, but the current development build of Saxon, with a new regex engine, returns false: that's how the problem came to my attention.

We need to decide whether to confirm the current specification or to be "bug-compatible" with existing implementations. If we do decide to be "bug-compatible" we need to decide exactly what characters at the end of the string should be ignored.
Comment 1 Michael Kay 2012-04-20 19:04:45 UTC
Mary Holstege reports on email that:

MarkLogic returns false.
Comment 2 Michael Kay 2012-05-15 15:58:22 UTC
Decided to keep the spec as it is.