<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hna.wiki/Template:Replace/doc?action=history&amp;feed=atom</id>
	<title>Template:Replace/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://hna.wiki/Template:Replace/doc?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://hna.wiki/Template:Replace/doc?action=history"/>
	<updated>2026-07-15T00:30:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://hna.wiki/Template:Replace/doc?diff=1276&amp;oldid=prev</id>
		<title>Kuhlau: Created page with &quot;{{Documentation/Header}} {{Lua|Replace}} This template replaces occurrences of any number of search terms in a string. By default, all occurrences of the search terms will be replaced with the desired terms, but particular occurrences of a search term (e.g., the first occurrence) can be specified.  This template uses Lua&#039;s Regular Expression (RegEx) version, which can also be used in this template&#039;s parameters. See [https://riptutorial.com/lua/example/20315/lua-pattern-m...&quot;</title>
		<link rel="alternate" type="text/html" href="https://hna.wiki/Template:Replace/doc?diff=1276&amp;oldid=prev"/>
		<updated>2025-08-30T03:17:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Documentation/Header}} {{Lua|Replace}} This template replaces occurrences of any number of search terms in a string. By default, all occurrences of the search terms will be replaced with the desired terms, but particular occurrences of a search term (e.g., the first occurrence) can be specified.  This template uses Lua&amp;#039;s Regular Expression (RegEx) version, which can also be used in this template&amp;#039;s parameters. See [https://riptutorial.com/lua/example/20315/lua-pattern-m...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation/Header}}&lt;br /&gt;
{{Lua|Replace}}&lt;br /&gt;
This template replaces occurrences of any number of search terms in a string. By default, all occurrences of the search terms will be replaced with the desired terms, but particular occurrences of a search term (e.g., the first occurrence) can be specified.&lt;br /&gt;
&lt;br /&gt;
This template uses Lua&amp;#039;s Regular Expression (RegEx) version, which can also be used in this template&amp;#039;s parameters. See [https://riptutorial.com/lua/example/20315/lua-pattern-matching here] for an explanation on how to use this RegEx variant, and [https://iamreiyn.github.io/lua-pattern-tester/ here] for a pattern tester.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
;Base function&lt;br /&gt;
{{T|Replace|v1=input string|v2=search term|v3=replacement term}}&lt;br /&gt;
&lt;br /&gt;
;Multiple replacement&lt;br /&gt;
{{T|Replace|v1=input string|v2=search-1|v3=replace-1|v4=search-2|v5=replace-2|v6=...|v7=search-X|v8=replace-X}}&lt;br /&gt;
* Each pair of unnamed parameters after the input string will be treated as a pair of search and replacement terms&lt;br /&gt;
&lt;br /&gt;
;Direct removals&lt;br /&gt;
{{T|Replace|v1=input string|v2=s1=search-1|v3=s2=search-2|v4=s3=search-3}}&lt;br /&gt;
* When no pairing replacement term is given, the searched term will instead be removed from the input string.&lt;br /&gt;
&lt;br /&gt;
;Mixed usage&lt;br /&gt;
{{T|Replace|v1=input string|v2=s1=search-1|v3=s2=search-2|v4=r2=replace-2|v5=s3=search-3|v6=r4=replace-4}}&lt;br /&gt;
* {{F|v=1|search-1}} will be removed&lt;br /&gt;
* {{F|v=1|search-2}} will be replaced by {{F|v=1|replace-2}}&lt;br /&gt;
* {{F|v=1|search-3}} will be removed&lt;br /&gt;
* As no {{F|v=1|search-4}} was given, {{F|v=1|replace-4}} is ignored&lt;br /&gt;
&lt;br /&gt;
;Key terms&lt;br /&gt;
The following terms will be replaced by the specified characters when used in the search or replace parameters&lt;br /&gt;
* {{F|{space} }} by {{F|&amp;amp;nbsp;}}&lt;br /&gt;
* {{F|{newline} }} by {{F|&amp;lt;br&amp;gt;|nw=1}}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
{{T|Replace|hi|i|ello|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|hello there|hello t|I am{space}|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|spaces are removed|{space}||_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|01010101010|0|ZERO|1|one|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|01010101010|0|ZERO|1|one|n=1|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|01010101010|0|ZERO|1|one|n1=3|n2=1,5|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{T|Replace|this supports regular expressions too|s(.-)s|B%1E|_Y_=1}}&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Template Data==&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Input String&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;2&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;s1&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Search Term 1&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Replace Term 1&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;r1&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;s2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Search Term 2&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;r2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Replace Term 2&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;s3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Search Term 3&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;r3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Replace Term 3&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;s4&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Search Term 4&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;r4&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Replace Term 4&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;s5&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Search Term 5&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;r5&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Replace Term 5&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;Replaces all occurrences of search term in a string with the replacement term.&amp;quot;,&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kuhlau</name></author>
	</entry>
</feed>