m
link to patterns tutorial added
No edit summary |
m (link to patterns tutorial added) |
||
| Line 17: | Line 17: | ||
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 PatternsTutorial. | 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]. | ||
> = string.gsub("Hello Lua user", "(%w+)", print) -- print any words found | > = string.gsub("Hello Lua user", "(%w+)", print) -- print any words found | ||