<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="xsl-elements" page="analyze-string" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:analyze-string</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:analyze-string"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>xsl:analyze-string</h1> <p>The <code>xsl:analyze-string</code> element is new in XSLT 2.0. It applies a regular expression to a supplied string value. The string is split into a sequence of substrings, each of which is classified as either a matching substring (if it matches the regular expression) or a non-matching substring (if it doesn't). The substrings are then processed individually: the matching substrings by a <code>xsl:matching-substring</code> element that appears as a child of the <code>xsl:analyze-string</code> instruction, the non-matching substrings by a similar <code>xsl:non-matching-substring</code> element. If either of these is omitted, the relevant substrings are not processed.</p> <p>The element has three attributes: <code>select</code> is an XPath expression whose value is the string to be analyzed; <code>regex</code> is the regular expression (which may be given as an attribute value template), and <code>flags</code> provides one or more Perl-like flags to control the way in which regular expression matching is performed, for example the value "m" indicates multi-line mode.</p> <p>When processing matching substrings, it is possible to call the <code>regex-group()</code> function to find the parts of the matching substring that matched particular parenthesized groups within the regular expression.</p> <p>There are <a href="http://www.w3.org/TR/xslt20/#regex-examples" class="bodylink">examples</a> of this element in the XSLT 2.0 Working Draft.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="apply-imports.xml">Next</a></p> </td> </tr> </table> </body> </html>