Returns an iterator function for finding pattern matches in a string. Alias for the standard library function string.gmatch
.
See also Lua library functions.
Signature:
iterator
=
gmatch("s",
"pattern")
Arguments:
s
- A string (string
)pattern
- A regular expression pattern (string
, pattern)
Returns:
iterator
- A function which, each time it is called, returns the next capture ofpattern
in the strings
; always returns the whole string ifpattern
specifies no captures (function
)
Examples:
-- print the components of an item link for w in gmatch(link, "([%d-]+)") do print(w) end -- example output, given an enchanted Heavy Lamellar Gauntelts of the Gorilla: -- 10242 -- 2564 -- 0 -- 0 -- 0 -- 0 -- 614 -- 0
This function is defined in the Lua standard libraries