regexp_gsplit(string, pattern)

Return an iterator function which can be used in a for loop to process each substring that does not match the regular expression pattern.

Example

t={}
for word in regexp_gsplit("the quick brown fox", "[ ]+") do
    t[#t+1] = word
end