xsl-list
[Top] [All Lists]

[xsl] Analyze-string Regex to Match Content within Curly Braces

2020-11-17 06:43:23
Once again I find myself at a loss when trying to write a regex in 
analyze-string that matches on an open/close curly brace combination. I'm using 
XSLT 2.0 and Saxon PE-9.6.0.7.
Here's an example of the text content:
<text>In the be{opthyphen}gin{opthyphen}ning</text>

I need to match all occurrences (none nested) of an open and close curly brace 
with the text that occurs in-between.
I started with this successful regex in a non-XSLT context:
{[a-z]+}

Then because the analyze-string @regex is an AVT I double the curly braces:
{{[a-z]+}}

thus:
<xsl:analyze-string select="$content" regex="{{[a-z]+}}" >

That produces the compile error "Syntax error at char 0 in regular expression. 
No expression before quantifier". I've tried everything I can think of in terms 
of using escapes, etc. I've also tried defining the regex as a variable and 
then referencing it from @regex. But I'm just missing something in the regex 
itself (I think). All help is appreciated.
Don
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>