Expand/Shrink

match_all

Definition: sequence res = match_all(object needle, sequence haystack, integer start=1, bool case_sensitive=true, overlap=false)
Description: Return the start positions of all slices of haystack equal to needle. Returns {} if none exist.
pwa/p2js: Supported.
Description: Like match(), by default match_all() is case sensitive, so "the" will not match "THE", however this can be changed by supplying false (0) in the fourth parameter.

Also by default match_all does not return overlapping slices, but that can be overridden as per the example below.

Note that Euphoria does not support either the case_sensitive or overlap parameters.
Example:
?match_all("aaaa","aaaaaaaa")               -- prints {1,5}
?match_all("aaaa","aaaaaaaa",overlap:=true) -- prints {1,2,3,4,5}

(ie 1..4 and 5..8 or 1..4, 2..5, 3..6, 4..7, and 5..8)
Implementation: See builtins\match.e (an autoinclude) for details of the actual implementation.
See Also: match