The QMMatch() function matches a string against a pattern template. It is analogous to the QMBasic MATCHES operator.
The function arguments are:
The QMMatch() function tests whether Src matches the Pattern template consisting of one or more concatenated items from the following list.
The values n and m are integers with any number of digits. m must be greater than or equal to n.
The 0A, nA, 0N, nN and "string" patterns may be preceded by a tilde (~) to invert the match condition. For example, ~4N matches four non-numeric characters such as ABCD (not a string which is not four numeric characters such as 12C4).
A null string matches patterns ..., 0A, 0X, 0N, their inverses (~0A, etc) and "".
The 0X and n-mX patterns match against as few characters as necessary before control passes to the next pattern. For example, the string ABC123DEF matched against the pattern 0X2N0X matches the pattern components as ABC, 12 and 3DEF.
The 0N, n-mN, 0A, and n-mA patterns match against as many characters as possible. For example, the string ABC123DEF matched against the pattern 0X2-3N0X matches the pattern components as ABC, 123 and DEF.
The pattern string may contain alternative templates separated by value marks. The QMMatch() function tries each template in turn until one is a successful match against the string.
This function is evaluated on the client system and does not require a server connection to be open.
The examples below test whether the contents of PartCode is formed from between two and four letters followed by three digits, returning OK as a True/False value.