The MATCH or MATCHES function allows pattern matching to be applied to an expression.
expression1 MATCHES expression2
expression1 may evaluate to any type. expression2 should evaluate to a valid pattern matching string as described below. expression1 is then matched to the pattern supplied and a value of Boolean TRUE is returned if the pattern is matched. A value of Boolean FALSE is returned if the pattern is not matched.
expression2 can contain any number of patterns to match separated by value marks. The value mark implies a logical OR of the specified patterns and the match will evaluate to Boolean TRUE if expression1 matches any of the specified patterns.
Pattern matching strings are constructed from the rule table shown below. When reading the table n refers to any integer number.
The pattern will be applied to all characters in expression1 and it must match all characters in the expression to evaluate as Boolean TRUE.
The integer value n can be specified as 0. This will cause the pattern to match any number of characters of the specified type.
matches if all characters in Var are numeric or Var is a null string.
matches if Var contains any number of numerics followed by the . character followed by 2 numeric characters. e.g. 345.65 or 9.99
matches if the variable Serno consists of a string of 4 arbitrary characters followed by the ":" character then 6 numerics then the ";" character and then 2 alphabetic characters. e.g. 1.2.:123456;AB or 17st:456789;FB