WoW:Pattern matching: Difference between revisions

→‎"Regexes" (patterns) in Lua: gsub was replaced with gmatch
m (→‎Constructing a pattern: I don't know how that little caveat was missed.)
(→‎"Regexes" (patterns) in Lua: gsub was replaced with gmatch)
Line 7: Line 7:
* [[API_strfind|string.find]](string, pattern) -- finds the first instance of pattern in string
* [[API_strfind|string.find]](string, pattern) -- finds the first instance of pattern in string
* string.gfind(string, pattern) -- when called repeatedly, finds each successive instance of pattern in string
* string.gfind(string, pattern) -- when called repeatedly, finds each successive instance of pattern in string
* [[API gsub|string.gsub]](string, pattern, repl) -- returns a string where all instances of pattern in string have been replaced with repl
* [[API gsub|string.gmatch]](string, pattern, repl) -- returns a string where all instances of pattern in string have been replaced with repl
* [[API strmatch|string.match]](string, pattern, init) -- Returns a list of matches of pattern in string, starting search at init (1 is the first character of string, 2 is the second, etc.).
* [[API strmatch|string.match]](string, pattern, init) -- Returns a list of matches of pattern in string, starting search at init (1 is the first character of string, 2 is the second, etc.).


Anonymous user