This Boolean operator is used to determine whether a particular value matches a pattern. This operator has the value, pattern, and exact attributes. This operator has no child elements and evaluates to true if and only if the value of value matches the glob-style pattern contained in pattern. If exact is true, the values must be a case-sensitive match. Otherwise, the values can be a case-insensitive match.
The <matches> operator has the following attributes:
value – A required attribute that is the value to be matched against the pattern. This attribute can reference simple substitution variables.
pattern – A required attribute that is the pattern to be matched. This attribute can reference simple substitution variables.
exact – An optional attribute that is true if a case-sensitive match should be performed, false otherwise. Defaults to false.
The following examples show how <matches> is used and the results:
The following statement evaluates to true.
<matches value="True" pattern="true"/> |
The following statement evaluates to true.
<matches value="True" pattern="t*"/> |
The following statement evaluates to false.
<matches value="blue" pattern="*u"/> |
The following statement evaluates to true.
<matches value="True" pattern="t?ue"/> |
The following statement evaluates to false.
<matches value="Tue" pattern="t?ue"/> |
The following statement evaluates to false.
<matches value="True" pattern="t*" exact="true"/> |
The following statement evaluates to true if var1 matches the pattern of var2.
<matches value=":[var1]" pattern=":[var2]"/> |