<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="https://dsntk.io/spec/DMN/1111-feel-matches-function"
name="1111-feel-matches-function"
id="_1111-feel-matches-function"
xmlns="https://www.omg.org/spec/DMN/20211108/MODEL/">
<description>
Examples of FEEL built-in function `matches(input, pattern, flags?)` in category string functions.
</description>
<itemDefinition name="booleanList" isCollection="true">
<typeRef>boolean</typeRef>
</itemDefinition>
<decision name="decision001">
<description>Evaluates `matches` function with null input.</description>
<question>What is the result of FEEL expression 'matches(null, "pattern")'?</question>
<allowedAnswers>null (boolean)</allowedAnswers>
<variable typeRef="boolean" name="decision001"/>
<literalExpression>
<text>matches(null, "pattern")</text>
</literalExpression>
</decision>
<decision name="decision002">
<description>Evaluates `matches` function with null pattern.</description>
<question>What is the result of FEEL expression 'matches("input", null)'?</question>
<allowedAnswers>null (boolean)</allowedAnswers>
<variable typeRef="boolean" name="decision002"/>
<literalExpression>
<text>matches("input", null)</text>
</literalExpression>
</decision>
<decision name="decision003">
<description>Evaluates `matches` function with null flags.</description>
<question>What is the result of FEEL expression 'matches("abracadabra", "bra", null)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable typeRef="boolean" name="decision003"/>
<literalExpression>
<text>matches("abracadabra", "bra", null)</text>
</literalExpression>
</decision>
<decision name="fn-matches2args-1">
<description>Evaluates "matches" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(lower bound)</description>
<variable typeRef="boolean" name="fn-matches2args-1"/>
<literalExpression>
<text>matches("This is a characte","This is a characte")</text>
</literalExpression>
</decision>
<decision name="fn-matchesErr-1">
<description>Invalid flag for third argument of matches.</description>
<variable typeRef="boolean" name="fn-matchesErr-1"/>
<literalExpression>
<text>matches("abracadabra", "bra", "p")</text>
</literalExpression>
</decision>
<decision name="fn-matches-27">
<description>Check for the correct behavior of ^ and $ in multi-line mode This test case was motivated by the resolution of Bug Report 4543</description>
<variable typeRef="boolean" name="fn-matches-27"/>
<literalExpression>
<text>matches("\nabcd\ndefg\n", "^$", "m")</text>
</literalExpression>
</decision>
<decision name="fn-matches-28">
<description>Check for the correct behavior of ^ and $ in multi-line mode This test case was motivated by the resolution of Bug Report 4543</description>
<variable typeRef="boolean" name="fn-matches-28"/>
<literalExpression>
<text>matches("abcd\n\ndefg\n ", "^$", "m")</text>
</literalExpression>
</decision>
<decision name="fn-matches-45">
<description>"." does NOT match CR in default mode</description>
<variable typeRef="boolean" name="fn-matches-45"/>
<literalExpression>
<text>matches("Mary\u000DJones", "Mary.Jones")</text>
</literalExpression>
</decision>
<decision name="caselessmatch01">
<description>Simple call of matches() with "i" flag</description>
<variable typeRef="boolean" name="caselessmatch01"/>
<literalExpression>
<text>matches("abc", "ABC", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch02">
<description>Call of matches() with "i" flag and a character range</description>
<variable typeRef="boolean" name="caselessmatch02"/>
<literalExpression>
<text>matches("abZ", "[A-Z]*", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch03">
<description>Call of matches() with "i" flag and a character range</description>
<variable typeRef="boolean" name="caselessmatch03"/>
<literalExpression>
<text>matches("abZ", "[a-z]*", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch07">
<description>Call of matches() with "i" flag and Kelvin sign Kelvin sign</description>
<variable typeRef="boolean" name="caselessmatch07"/>
<literalExpression>
<text>matches("\u212A", "k", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch08">
<description>Call of matches() with "i" flag and range subtraction</description>
<variable typeRef="boolean" name="caselessmatch08"/>
<literalExpression>
<text>matches("x", "[A-Z-[OI]]", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch09">
<description>Call of matches() with "i" flag and range subtraction</description>
<variable typeRef="boolean" name="caselessmatch09"/>
<literalExpression>
<text>matches("X", "[A-Z-[OI]]", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch10">
<description>Call of matches() with "i" flag and range subtraction</description>
<variable typeRef="boolean" name="caselessmatch10"/>
<literalExpression>
<text>matches("O", "[A-Z-[OI]]", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch11">
<description>Call of matches() with "i" flag and range subtraction</description>
<variable typeRef="boolean" name="caselessmatch11"/>
<literalExpression>
<text>matches("i", "[A-Z-[OI]]", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch12">
<description>Call of matches() with "i" flag and negation</description>
<variable typeRef="boolean" name="caselessmatch12"/>
<literalExpression>
<text>matches("Q", "[^Q]", "i")</text>
</literalExpression>
</decision>
<decision name="caselessmatch13">
<description>Call of matches() with "i" flag and negation</description>
<variable typeRef="boolean" name="caselessmatch13"/>
<literalExpression>
<text>matches("q", "[^Q]", "i")</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-1">
<description>The pattern can't be the empty sequence.</description>
<variable typeRef="boolean" name="K-MatchesFunc-1"/>
<literalExpression>
<text>matches("input", [])</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-2">
<description>matches() takes at least two arguments, not one.</description>
<variable typeRef="boolean" name="K-MatchesFunc-2"/>
<literalExpression>
<text>matches("input")</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-3">
<description>The third argument cannot be the empty sequence.</description>
<variable typeRef="boolean" name="K-MatchesFunc-3"/>
<literalExpression>
<text>matches("input", "pattern", [])</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-4">
<description>Only three arguments are accepted.</description>
<variable typeRef="boolean" name="K-MatchesFunc-4"/>
<literalExpression>
<text>matches("input", "pattern", "", [])</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-5">
<description>The flags argument cannot contain whitespace.</description>
<variable typeRef="boolean" name="K-MatchesFunc-5"/>
<literalExpression>
<text>matches("input", "pattern", " ")</text>
</literalExpression>
</decision>
<decision name="K-MatchesFunc-6">
<description>The flags argument cannot contain 'X'.</description>
<variable typeRef="boolean" name="K-MatchesFunc-6"/>
<literalExpression>
<text>matches("input", "pattern", "X")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-1">
<description>Whitespace in the regexp is collapsed.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-1"/>
<literalExpression>
<text>matches("hello world", "hello\ sworld", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-2">
<description>Whitespace(before) in the regexp is collapsed, but not inside a character class.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-2"/>
<literalExpression>
<text>matches("hello world", " hello[ ]world", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-3">
<description>Whitespace(after) in the regexp is collapsed, but not inside a character class.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-3"/>
<literalExpression>
<text>matches("hello world", "hello[ ]world ", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-4">
<description>Whitespace(in the middle) in the regexp is collapsed, but not inside a character class.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-4"/>
<literalExpression>
<text>matches("hello world", "he ll o[ ]worl d", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-5">
<description>whitespace in the regexp is collapsed, and should therefore compile.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-5"/>
<literalExpression>
<text>matches("hello world", "\p{ IsBasicLatin}+", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-6">
<description>whitespace in the regexp is collapsed completely, and should therefore compile and match.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-6"/>
<literalExpression>
<text>matches("hello world", "\p{ I s B a s i c L a t i n }+", "x")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-7">
<description>whitespace in the regexp is not collapsed, and should therefore not compile.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-7"/>
<literalExpression>
<text>matches("hello world", "\p{ IsBasicLatin}+")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-8">
<description>Since no string is captured by the back-reference, the single character is matched.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-8"/>
<literalExpression>
<text>matches("h", "(.)\3")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-9">
<description>Since no string is captured by the back-reference, the single character is matched(#2).</description>
<variable typeRef="boolean" name="K2-MatchesFunc-9"/>
<literalExpression>
<text>matches("h", "(.)\2")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-10">
<description>A non-matching backwards-reference matches the empty string.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-10"/>
<literalExpression>
<text>matches("input", "\3")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-11">
<description>Use a back reference inside a character class.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-11"/>
<literalExpression>
<text>matches("abcd", "(asd)[\1]")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-12">
<description>Use a back reference inside a character class(#2).</description>
<variable typeRef="boolean" name="K2-MatchesFunc-12"/>
<literalExpression>
<text>matches("abcd", "(asd)[asd\1]")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-13">
<description>Use a back reference inside a character class(#3).</description>
<variable typeRef="boolean" name="K2-MatchesFunc-13"/>
<literalExpression>
<text>matches("abcd", "(asd)[asd\0]")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-14">
<description>Use a back reference inside a character class(#3).</description>
<variable typeRef="boolean" name="K2-MatchesFunc-14"/>
<literalExpression>
<text>matches("abcd", "1[asd\0]")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-15">
<description>A negative character class never match a non-character.</description>
<variable typeRef="booleanList" name="K2-MatchesFunc-15"/>
<literalExpression>
<text>[matches("a", "a[^b]"), matches("a ", "a[^b]")]</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-16">
<description>Use a pattern whose interpretation is unknown. See public report 4466 and 21425.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-16"/>
<literalExpression>
<text>matches("input", "[0-9-.]*/")</text>
</literalExpression>
</decision>
<decision name="K2-MatchesFunc-17">
<description>Caseless match with back-reference.</description>
<variable typeRef="boolean" name="K2-MatchesFunc-17"/>
<literalExpression>
<text>matches("aA", "(a)(a)", "i")</text>
</literalExpression>
</decision>
</definitions>