[Bug 4634] [FO] poorly formed back-references

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4634

           Summary: [FO] poorly formed back-references
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: mike@saxonica.com
        ReportedBy: andrew.eisenberg@us.ibm.com
         QAContact: public-qt-comments@w3.org


In section 7.6.1, Regular Expression Syntax, we say:

"Back-references are allowed. ... A back-reference matches the string that was
matched by the nth capturing subexpression within the regular expression, that
is, the parenthesized subexpression whose opening left parenthesis is the nth
unescaped left parenthesis within the regular expression. The closing right
parenthesis of this subexpression must occur before the back-reference. ..."

In Bug #4610 we considered the following query:

replace("abcd", "(a)\2(b)", "")

While I interpreted the violation of "must occur" as requiring that an error be
raised, Michael Kay interpreted it as causing the back-reference to fail to
match a string.


The replace function acknowledges that a pattern can be invalid, saying:

"An error is raised [err:FORX0002] if the value of $pattern is invalid
according to the rules described in section 7.6.1 Regular Expression Syntax."


Let me suggest that this be clarified by changing the existing sentence: 

"The closing right parenthesis of this subexpression must occur before the
back-reference."

to the following:

"The regular expression is invalid if the closing right parenthesis of this
subexpression occurs before the back-reference."

Received on Tuesday, 12 June 2007 20:10:29 UTC