fn:analyze-string

Analyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression.

analyze-string($value as xs:string?, $pattern as xs:string, $flags as xs:string?:="") ➔ element(fn:analyze-string-result)

Arguments

 

$value

xs:string?

The input string

 

$pattern

xs:string

A regular expression

 

$flags

xs:string?

:= ""

Flags controlling the interpretation of the regular expression

Result

element(fn:analyze-string-result)

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

XPath 4.0 Functions and Operators

Saxon availability

Available in XPath 3.0, XSLT 3.0, XQuery 3.0, and later versions. From Saxon 9.6, available in all editions. Available for all platforms.

Notes on the Saxon implementation

Available since Saxon 9.3.

Saxon supports extended syntax for the flags argument: see the fn:matches function for details.

See also:

fn:matches()