xsl-list
[Top] [All Lists]

Re: [xsl] Regex in @select Escaping Puzzle

2020-08-16 12:01:30
On Sun, 2020-08-16 at 15:43 +0000, Eliot Kimber ekimber(_at_)contrext(_dot_)com
wrote:

<xsl:analyze-string select="."
regex="\{{\{{image_.+}}(.+)\{{\{{/image}}}}">

Remember that the attribute is an attribute value template so curly
braces are special.

Best is probably,

<xsl:variable as="xs:string" name="regex"
  select="\{\{image_100\}\}GEO_AS_MC_M01_T02_05.eps\{\{/image\}\}" />

<xsl:analyze-string regex="{ $regex }" select="." />

I sometimes write [{] and [}] for braces - and the same for parens - as
it's hard to remember which regex syntaxes treat \{ as special and
which are the other way round!


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
--~----------------------------------------------------------------
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>