LIKE
c = a LIKE b
Regular-expression operator. Compares the left part a
of
the expression with the right side regex pattern b
and
returns true
or false
.
*
matches any sequence of characters (zero or more)?
matches any character[SET]
matches any character in the specified set[!SET]
or[^SET]
matches any character not in the specified set
A set is composed of characters or ranges. A range is defined by
character - hyphen - character (as in 0-9 or A-Z).
[0-9a-zA-Z_]
is the minimal set of characters allowed in
the [..]
pattern construct. To suppress the special
syntactic significance of any of "[]*?!^-\
, and match the
character exactly, precede it with a \\
.
For more information about regular-expressions please see http://www.regular-expressions.info/examples.html.
Option for matching algorithm
OPTION MATCH PCRE [CASELESS]|SIMPLE
PCRE
sets as default matching algorithm to
(P)erl-(C)ompatible (R)egular (E)xpressions library or back to simple
one with SIMPLE
.
Example 1
print "Hello" LIKE "*[oO]" ' Output 1
print "Hello" LIKE "He??o" ' Output 1
print "Hello" LIKE "hello" ' Output 0
print "Hello" LIKE "[Hh]*" ' Output 1
print "-[Hello]-" Like "\\-\\[?*\\]\\-" ' Output 1
Code samples using LIKE
3dtictac.bas
3dttt.bas
3dttt.bas
4tune.bas
7gables.bas
Balleta 2-11-15.bas
betrayal: crows ii.bas
bolmo.bas
bulls and cows.bas
checkers.bas
checkers.bas
chess.bas
chess.bas
dogstar5.bas
draw rectangle.bas
Eliza.bas
eliza.bas
falling blocks - tetris.bas
filemanager.bas
fire.bas
g2 Life.bas
g3 Life.bas
g_col_pd.bas
glitter hopalong.bas
GUI RPSLS v2.bas
hopalong copy.bas
hopalong.bas
hopalong.bas
irc-bot.bas
Language
AND
AS
BAND
BG
BOR
BYREF
CALL
CASE
CATCH
CONST
DECLARE
DEF
DO
ELIF
ELSE
ELSEIF
END
END TRY
ENDIF
EQV
EXIT
FALSE
FI
FOR
FUNC
GOSUB
GOTO
IF
IFF
IMP
IN
LABEL
LET
LIKE
LOCAL
LSHIFT
MDL
MOD
NAND
NEXT
NOR
NOT
ON
OR
REM
REPEAT
RETURN
RSHIFT
SELECT
STEP
STOP
SUB
THEN
THROW
TO
TRUE
TRY
UNTIL
USE
USG
USING
WEND
WHILE
XNOR
XOR
If there is insufficient information on this page and you wish learn more about LIKE,
please send an email to smallbasic@gmail.com. You can help to improve information about
LIKE by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.