GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | LIKE

Edit History

LIKE

c = a LIKE b

Home > Reference > Language

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   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   Lava.bas   pirate.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  
This page was last edited on Thu, 27 Apr 2023 16:47:37 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.