Name
Like Operator
Syntax
result=stringLikepattern
-
string(required; String) The string to be tested against
pattern-
pattern(required; String) A series of characters used by the
Likeoperator to determine ifstringandpatternmatch
Return Type
Boolean
Description
If string matches
pattern, result
is True; otherwise,
result is False.
Rules at a Glance
If either
stringorpatternisNothing, thenresultwill beNothing.The default comparison method for the
Likeoperator is Binary. This can be overridden using theOptionComparestatement.Binary comparison is based on comparing the internal binary number representing each character; this produces a case-sensitive comparison.
Text comparison, the alternative to binary comparison, is case insensitive; therefore, A = a.
The sort order is based on the code page currently being used, as determined by the Windows regional settings.
The following table describes the special characters to use when creating a pattern; all other characters match themselves.
|
Character |
Meaning |
|---|---|
? |
Any single character |
* |
Zero or more characters |
# |
Any single digit (0-9) |
[list] |
Any single character in |
[!list] |
Any single character not in |
[] |
A zero-length string (“”) |
listis used to match a group of characters inpatternto a single character instringand can contain almost all available characters, including digits.Use a hyphen (
-) inlistto create a range of characters to match a character instring. For example,[A-D]will match A, ...