xsl-list
[Top] [All Lists]

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

2020-11-17 07:08:08

On 17.11.2020 13:43, Don Smith dsmith_lockesmith(_at_)yahoo(_dot_)com 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/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>