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($input as xs:string?, $pattern as xs:string) ➔ element(fn:analyze-string-result)

Arguments

 

$input

xs:string?

The input string

 

$pattern

xs:string

A regular expression

Result

element(fn:analyze-string-result)

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

Arguments

 

$input

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.0 Functions and Operators

XPath 3.1 Functions and Operators

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. However, the "j" and "n" flags to invoke a native regular expression engine are not supported for this function.

See also:

fn:matches()