Applies a regular expression to a supplied string value.
Content: ( xsl:matching-substring? , xsl:non-matching-substring? , xsl:fallback* )
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
XPath expression whose value is the string to be analyzed.
The regular expression, which may be given as an attribute value template.
One or more Perl-like flags to control the
way in which regular expression matching is performed, for example the value
Notes on the Saxon implementation
XSLT 3.0 removes the restriction that the regular expression must not be one that matches a zero-length string, so this is now allowed since Saxon 9.6.
xsl:analyze-string element 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 xsl:matching-substring element that appears
as a child of the
xsl:analyze-string instruction, the non-matching
substrings by a similar xsl:non-matching-substring element. If
either of these is omitted, the relevant substrings are not processed.
When processing matching substrings, it is possible to call the
regex-group() function to find the parts of the matching
substring that matched particular parenthesized groups within the regular
Examples of this element can be found in the XSLT 3.0 Specification.