a simple code
Local MY$ = "If(*)Then*Else*EndIf" Local res$[] = Extract(my) For Local s$ = EachIn res Print s Next Function Extract$[](text$) 'find THEN 'find ENDIF text=Upper(text) Local f1:Int , f2:Int,f3:Int f1 = Instr(text , "THEN") f2 = Instr(text,"ELSE") f3 = Instr(text , "ENDIF") Print f1+" "+f2+" "+f3 Local arr$[3] arr[0] = text[2..f1 - 1] arr[1] = text[f1+3..f2 - 1] arr[2] = text[f2+3..f3 - 1] Return arr End Function