Returns an iterator function for returning the next capture from a pattern over a string. If there is no capture, the whole match is produced.
See string.find for an explanation of regular expressions.
for w in string.gmatch ("nick takes a stroll", "%a+") do
print (w)
end -- for
-->
nick
takes
a
stroll