The fn:matches function determines whether a string matches a specific pattern.
>>-fn:matches(source-string,pattern-+--------+-)--------------->< '-,flags-'
source-string is an xs:string value or the empty sequence.
pattern is an xs:string value.
If the s flag is not specified, the dot (.) matches any character except the new line character (X'0A').
If the m flag is not specified, the caret (^) matches the start of the string, and the dollar sign ($) matches the end of the string.
If the i flag is not specified, case-sensitive matching is done.
If the x flag is not specified, whitespace characters are used for matching.
The length of source-string and pattern is limited to 32000 bytes.
If source-string is not the empty sequence, the returned value is true if source-string matches pattern. The returned value is false if source-string does not match pattern.
If pattern does not contain the string- or line-starting character caret (^), or the string- or line-ending character dollar sign ($), source-string matches pattern if any substring of source-string matches pattern. If pattern contains the string- or line-starting character caret (^), source-string matches pattern only if source-string matches pattern from the beginning of source-string or the beginning of a line in source-string. If pattern contains the string- or line-ending character dollar sign ($), source-string matches pattern only if source-string matches pattern at the end of source-string or at the end of a line of source-string. The m flag determines whether the match occurs from the beginning of the string or the beginning of a line.
If source-string is the empty sequence, the returned value is false.
fn:matches("abbcacadbdcd","(ac)|(bd)")
The returned value is true.
fn:matches("bd","^(ac)|(bd)$")
The returned value is true.
fn:matches("abc1234","ABC 1234", "ix")
The returned value is true.