Navigation menu

WoW:API gsub: Difference between revisions

Jump to navigation Jump to search
37 bytes added ,  30 July 2008
Added link
(Use Lua/Libshortcut template. Change category from "LUA Functions" to "Lua functions".)
(Added link)
Line 18: Line 18:
  bnanaa  2
  bnanaa  2


If the replacement is a function, not a string, the arguments passed to the function are any captures that are made. If the function returns a string, the value returned is substituted back into the string. Just like string.find() we can use regular expressions to search in strings. Patterns are covered in the [http://lua-users.org/wiki/PatternsTutorial Patterns Tutorial on Lua-Users.org].
If the replacement is a function, not a string, the arguments passed to the function are any captures that are made. If the function returns a string, the value returned is substituted back into the string. Just like string.find() we can use regular expressions to search in strings. Patterns are covered in the [http://lua-users.org/wiki/PatternsTutorial Patterns Tutorial on Lua-Users.org], and [[HOWTO: Use Pattern Matching]].


  > = string.gsub("Hello Lua user", "(%w+)", print)  -- print any words found
  > = string.gsub("Hello Lua user", "(%w+)", print)  -- print any words found
Anonymous user