Re: Analyze-string Regex to Match Content within Curly Braces

"Martin Honnen [email protected]" <[email protected]>
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Message-ID <[email protected]>
On 17.11.2020 13:43, Don Smith [email protected] wrote:
> <text>In the be{opthyphen}gin{opthyphen}ning</text>


The curly braces need to be escaped as \{ and \}


   <xsl:param name="pattern" as="xs:string">\{([a-z]+)\}</xsl:param>

   <xsl:template match="text">
       <xsl:analyze-string select="." regex="{$pattern}">
           <xsl:matching-substring>
               <brace>
                   <xsl:value-of select="regex-group(1)"/>
               </brace>
           </xsl:matching-substring>
       </xsl:analyze-string>
   </xsl:template>

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.