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