MATCH([pattern][,string][,caseopt])
In the simplest case, the pattern contains only "fixed" characters. Fixed characters consist of the letters of the alphabet, numbers, and all other characters except the wild card characters and '00'X. Fixed characters in pattern are compared to characters in corresponding positions in string. When normal, case-insensitve matching is specified (or defaulted), the case of the characters in pattern and string is irrelevant, because the MATCH function folds both arguments to uppercase prior to comparison. When case- sensitive matching is specified, alphabetic characters must match exactly.
Wild card characters permit a single pattern to successfully match many strings. The valid wild card characters and their meanings are as follows:
In addition, the backslash (\) is defined as an escape character. When prefixed with the escape character, a wild card character is interpreted as a fixed character. For example, to search for a string that begins with an asterisk, you would code:
if match('\**',string) then say 'It matched!'The first asterisk is treated as a fixed character (because of the backslash), and the second is treated as a wild card character.
Note: To make the escape character fixed, use 2 consecutive backslashes, as in "\\abc".
say match('abc*','abcdef') /* '1' */
say match('abc*','abc') /* '1' */
say match('abc???','abcdef') /* '1' */
say match('abc???','abcd') /* '0' */
say match('*xyz','xyz') /* '1' */
say match('\*abc','abc') /* '0' */
say match('\*abc','*abc') /* '1' */