I perform a little regular expression in one of my xsl transforms ( xsl:analyze-string) and stumbled upon this effect, which made me rather uncomfortable because I really did not find any explanation ...
I searched for Non-Breaking-Spaces and En-Spaces, so I used the construct \p{Z}. According to many examples in the XSLT 2.0 Programmers Guide by Michael Kay, this should work. RegExBuddy also claims :)
Now my SaxonHE9.4N tells me
Error in regex: net.sf.saxon.trans.XPathException: expected ({)
After several tests and errors, I simply doubled the brackets \p{{Z}}... and it worked !? But this time, RegExBuddy does not approve!
Can someone give me an explanation of this effect? I could not find anything pleasant on the Internet ...
Thanks in advance!
Edit: I tried the same thing inside a function replace(), and the version with two brackets did not work. I had to do this with separate brackets!
source
share