Home > lang > like 
 en fr de es it nl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Search  Administration  
Documentation  
Warning! This page is not translated.  See english version 
LIKE
Result = Expression [ NOT ] LIKE Pattern AS Boolean

Returns TRUE if the Expression string matches the Pattern string.

If NOT is specified, the test is inverted.

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.
{aaa,bbb,...} One of the string between square brackets. The strings are separated by commas.
\x The character x, even if it is a generic character. Use that for matching a generic character.

Example

PRINT "Gambas" LIKE "G*"

True

PRINT "Gambas" LIKE "?[Aa]*"

True

PRINT "Gambas" LIKE "G[^Aa]*"

False

PRINT "Gambas" Not Like "M{$,onsanto,afia}"

True

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]\\*"

False

LIKE only deals with ASCII strings. If you need to match UTF-8 strings, use the gb.pcre component.

See also

String Operators, String Functions