# matches

Returns true if the given string matches the given regular expression

matches($input as xs:string?, $pattern as xs:string) → xs:boolean

Arguments
| $input | xs:string? | The string to be matched against a regular expression
| $pattern | xs:string | The regular expression
Result | xs:boolean

matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) → xs:boolean

Arguments
| $input | xs:string? | The string to be matched against a regular expression
| $pattern | xs:string | The regular expression
| $flags | xs:string | Flags that control the interpretation of the regular expression
Result | xs:boolean

Links to W3C specifications

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

Applies to: XPath 2.0, XSLT 2.0, XQuery 1.0 and later versions

XPath 2.0 Specification

XPath 3.0 Specification

Notes on the Saxon implementation

Saxon 9.3 introduces support for the `q` flag, and for XPath 3.0 regular expression enhancements, provided XPath 3.0 is enabled.

Next