The regex attribute is an attribute value template, so curly braces are treated as enclosing an XPath expression. To escape them, they need to be doubled as {{ or }}. Alternatively, many people prefer to write the regular expression in a variable to avoid this problem:
<xsl:variable name="regex">a{3}</xsl:variable>
<xsl:analyze-string regex="{$regex}">
Incidentally, there's nothing specific to Saxon in this question/problem. General XSLT coding questions are best sent to the xsl-list at
Michael Kay

From: [] On Behalf Of Vanfleet, David
Sent: 17 August 2007 22:36
Subject: [saxon] Help with Saxon regular expressions and curly braces


I’m using the <xsl:analyze-string> element to match a string that contains curly braces (for example: “${some_string}” ) and I’m having a hard time being able to match the curly braces. I’ve tried escaping them by using something like regex=”\\{” but that does not work. I understand that curly braces have a special meaning inside of a regular expression, I need to be able to get around that? Any help here would be appreciated.