In a logical expression, you can compare a string expression against another string (called a match criterion), character position by character position from left to right. Use of this feature is similar to use of regular expressions in UNIX® or Perl.
An example is as follows:
// variable myVar01 is the string expression // whose contents will be compared to a match criterion myVar01 = "abcdef"; // the next logical expression evaluates to "true" if (myVar01 matches "a?c*") ; end
The match criterion can be either a literal or item of type CHAR or MBCHAR; or an item of type UNICODE. You can include any of these characters in the match criterion:
[abc]
[a-c]
The hyphen (-) has no special meaning outside of bracket delimiters.
[^abc]
The escape character usually precedes a character that is otherwise meaningful in the match criterion; for example, an asterisk (*) or a question mark (?).
When you use the backward virgule as an escape character (as is the default behavior), a problem arises because EGL uses the same escape character to allow inclusion of a quote mark in any text expression. In the context of a match criterion, you must specify two backward virgules because the text available at run time is the text that lacks the initial virgule.
It is recommended that you avoid this problem. Specify another character as the escape character by using the escape clause, as shown in a later example. However, you cannot use a double quote mark (") as an escape character.
Any other character in matchCriterion is a literal that is compared to a single character in string expression.
// variable myVar01 is the string expression // whose contents will be compared to a match criterion myVar01 = "ab*def"; // the next logical expression evaluates to "true" if (myVar01 matches "ab\\*[abcd][abcde][^a-e]") ; end // the next logical expression evaluates to "true" if (myVar01 matches "ab+*def" escape "+") ; end
Related reference
EGL statements
Logical expressions
Text expressions