match

Definition: integer i = match(sequence s1, sequence s2, integer start=1, bool case_insensitive=false)
Description: Try to match s1 against some slice of s2. If successful, return the element number of s2 where the (first) matching slice begins, at start or later (if specified), else return 0.

By default match is case sensitive, so "the" will not match "THE", however this can be changed by supplying true (1 or any non-zero value) in the fourth parameter. In order to supply the fourth (positional) parameter, you must also supply the third - unlike OpenEuphoria, which allows ",,1" syntax, that I have no plans to ever add. So, obviously, to alter match(x,s) to become case in-sensitive, it must become match(x,s,1,true), and replace ",,true" with ",1,true". Alternatively you can use named parameters: match("the",s,case_insensitive:=true) however that is not supported by OpenEuphoria.

The match_from() routine, which predated optional parameters, is now deprecated (and never had case insensitivity). Simply use match() with the optional third parameter instead. Update: match_from has now been permanently removed.
Example 1:
location = match("hi", "Phix") -- location is set to 2
Example 2:
location = match("the", "the cat sat on the mat", 4)
-- location is set to 16, not 1, because a start index of 4 was specified
Example 3:
line = line[1..match("--",line)-1]  -- remove comment
-- A nifty clever clogs trick: if match returns 0 then line is unaltered, 
-- (ie line:=line[1..-1]), otherwise only the text before "--" is kept.
See Also: find, compare, wildcard_match