Result = Expression LIKE Pattern AS Boolean
Returns TRUE if the Expression string matches the Pattern string.
The pattern is not case sensitive, and it can contain the following generic characters:
Generic character | Matches |
---|---|
* | Any number of any character. |
? | Any single character. |
[abc] | Any character between the brackets. |
[x-y] | Any character in the interval. |
[^x-y] | Any character not in the interval. |
space | Any number of space or character with an ASCII code lower then 32. |
The special generic character \ prevents its following character to be interpreted as generic.
PRINT "Gambas" LIKE "G*" <hr>True
PRINT "Gambas" LIKE "?[Aa]*" <hr>True
PRINT "Gambas" LIKE "G[^Aa]*" <hr>False
![]() |
You must double the backslash character, otherwise \* will be interpreted by the compiler as a special character like \n, \t, ...
Or you can use this pattern string: LIKE "G[Aa][*]"
PRINT "Gambas" LIKE "G[Aa]\\\\*" <hr>False |