I didn’t check the regex in general, but one reason I think why it fails is the escaped quote. For example, the following query is illegal in XQuery 3.1…
matches('a"b', 'a"b')
…where as the following one is ok:
matches('a"b', 'a"b')
On Mon, Sep 12, 2016 at 1:15 PM, Hans-Juergen Rennau hrennau@yahoo.de wrote:
Cordial thanks, Liam - I was not aware of that!
@Joe: Rule of life: when one is especially sure to be right, one is surely wrong, and so was I, and right were you(r first two characters).
Liam R. E. Quin liam@w3.org schrieb am 5:54 Montag, 12.September 2016:
Hans-Jürgen, wrote:
! Already the first
two characters (?render the expression invalid:(1) An unescaped ? is an occurrence indicator, making the preceding entity optional(2) An unescaped ( is used for grouping, it does not repesent anything => there is no entity preceding the ? which the ? could make optional => error
Actually (?: .... ) is a non-capturing group, defined in XPath 3.0 and XQuery 3.0, based on the same syntax in other languages.
This extension, like a number of others, is useful because the expression syntax defined by XSD doesn't make use of capturing groups (there's no \1 or $1 or whatever), and so it doesn't need non-capturing groups, but in XPath and XQuery they are used.
See e.g. https://www.w3.org/TR/xpath-functions-30/#regex-syntax
Liam
-- Liam R. E. Quin liam@w3.org The World Wide Web Consortium (W3C)