# 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)

Links to W3C specifications

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

Applies to: XPath 3.0, XSLT 3.0, XQuery 3.0 (if enabled in Saxon: requires Saxon-PE or Saxon-EE)

XPath 3.0 Specification

Notes on the Saxon implementation

New in Saxon 9.3

Next