I'm expecting the first two regex-group values to be empty (troubleshooting someone else's code) in the following code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xs xd"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:analyze-string select="'1949'" regex="([0-9]{{1,2}})?\s?([A-Z]{{1}}[a-z]{{1,8}}\.?)?\s?([0-9]{{4}})">
<xsl:matching-substring>
<xsl:text>regex-group(1)=</xsl:text><xsl:value-of select="regex-group(1)"/><xsl:text>
</xsl:text>
<xsl:text>regex-group(2)=</xsl:text><xsl:value-of select="regex-group(2)"/><xsl:text>
</xsl:text>
<xsl:text>regex-group(3)=</xsl:text><xsl:value-of select="regex-group(3)"/><xsl:text>
</xsl:text>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>
</xsl:stylesheet>
but instead (using saxon 9.6.0.5 [updated - also saxon 9.6.0.7]) I get:
regex-group(1)=1
regex-group(2)=
regex-group(3)=1949
I'm debugging someone else's code which has worked previously: is this a bug in saxon? Or am I missing something that's causing that '1' to be returned?
Since this gives the expected result in saxon 9.5.1.7, I think this is a bug, so I've opened a report with Saxonica.