Revision Difference
string.gsub#527615
<function name="gsub" parent="string" type="libraryfunc">
<description>This functions main purpose is to replace certain character sequences in a string using <page>Patterns</page>.</description>
<realm>Shared and Menu</realm>
<args>
<arg name="string" type="string">String which should be modified.</arg>
<arg name="pattern" type="string">The pattern that defines what should be matched and eventually be replaced.</arg>
<arg name="replacement" type="string">In case of a string the matches sequence will be replaced with it.
<arg name="replacement" type="string">In case of a string the matched sequence will be replaced with it.
In case of a table, the matched sequence will be used as key and the table will tested for the key, if a value exists it will be used as replacement.
In case of a function all matches will be passed as parameters to the function, the return value(s) of the function will then be used as replacement.</arg>
<arg name="maxReplaces" type="number" default="nil">Maximum number of replacements to be made.</arg>
</args>
<rets>
<ret name="" type="string">replaceResult</ret>
<ret name="" type="number">replaceCount</ret>
</rets>
</function>
<example>
<description>Replaces "hello" with "hi" in the string "hello there!"</description>
<code>string.gsub("hello there!", "hello", "hi")</code>
<output>hi there!</output>
</example>