<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16809</bug_id>
          
          <creation_ts>2012-04-20 17:01:40 +0000</creation_ts>
          <short_desc>[FO3.0] &apos;$&apos; in regular expressions</short_desc>
          <delta_ts>2012-05-15 15:58:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 3.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66901</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-04-20 17:01:40 +0000</bug_when>
    <thetext>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 &apos;$&apos;. 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 &apos;$&apos; in this way. As evidence, the XSLT 2.0 test case regex02 expects &apos;$&apos; 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(&apos;abcd&apos;, codepoints-to-string(10), &apos;defg&apos;, codepoints-to-string(10)), &quot;g$&quot;)

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&apos;s how the problem came to my attention.

We need to decide whether to confirm the current specification or to be &quot;bug-compatible&quot; with existing implementations. If we do decide to be &quot;bug-compatible&quot; we need to decide exactly what characters at the end of the string should be ignored.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66906</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-04-20 19:04:45 +0000</bug_when>
    <thetext>Mary Holstege reports on email that:

MarkLogic returns false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67749</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-05-15 15:58:22 +0000</bug_when>
    <thetext>Decided to keep the spec as it is.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>