<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://petitplanet.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AReplace</id>
	<title>Module:Replace - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://petitplanet.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AReplace"/>
	<link rel="alternate" type="text/html" href="https://petitplanet.wiki/index.php?title=Module:Replace&amp;action=history"/>
	<updated>2026-04-12T05:58:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://petitplanet.wiki/index.php?title=Module:Replace&amp;diff=1137&amp;oldid=prev</id>
		<title>ReisuDesign: Created page with &quot;local p = {} local lib = require(&#039;Module:Feature&#039;) local ie = lib.isEmpty  function p.main(frame) 	local args = require(&#039;Module:Arguments&#039;).getArgs(frame, { 		parentFirst = true, 		wrapper = { &#039;Template:Replace&#039; } 	}) 	return p._main(args) end  function p._main(args) 	local inputString = args[1] or nil 	local search = args[2] or args.s1 or nil 	local replace = args[3] or args.r1 or &#039;&#039;  	-- argument validation 	if ie(inputString) then 		return &#039;&#039; 	end 	if ie(search) then...&quot;</title>
		<link rel="alternate" type="text/html" href="https://petitplanet.wiki/index.php?title=Module:Replace&amp;diff=1137&amp;oldid=prev"/>
		<updated>2025-11-12T14:20:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {} local lib = require(&amp;#039;Module:Feature&amp;#039;) local ie = lib.isEmpty  function p.main(frame) 	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, { 		parentFirst = true, 		wrapper = { &amp;#039;Template:Replace&amp;#039; } 	}) 	return p._main(args) end  function p._main(args) 	local inputString = args[1] or nil 	local search = args[2] or args.s1 or nil 	local replace = args[3] or args.r1 or &amp;#039;&amp;#039;  	-- argument validation 	if ie(inputString) then 		return &amp;#039;&amp;#039; 	end 	if ie(search) then...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local lib = require(&amp;#039;Module:Feature&amp;#039;)&lt;br /&gt;
local ie = lib.isEmpty&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		parentFirst = true,&lt;br /&gt;
		wrapper = { &amp;#039;Template:Replace&amp;#039; }&lt;br /&gt;
	})&lt;br /&gt;
	return p._main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	local inputString = args[1] or nil&lt;br /&gt;
	local search = args[2] or args.s1 or nil&lt;br /&gt;
	local replace = args[3] or args.r1 or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- argument validation&lt;br /&gt;
	if ie(inputString) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if ie(search) then&lt;br /&gt;
		return inputstring&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.unstrip then&lt;br /&gt;
		inputString = mw.text.unstrip(inputString)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args[4] or args.s2 then&lt;br /&gt;
		local y = 2&lt;br /&gt;
		while args[y] or args[&amp;#039;s&amp;#039; .. y/2] do&lt;br /&gt;
			inputString = p.Replace(inputString, (args[y] or args[&amp;#039;s&amp;#039;..y/2]), (args[y+1] or args[&amp;#039;r&amp;#039;..y/2] or &amp;#039;&amp;#039;), (args.n or args[&amp;#039;n&amp;#039;..y/2]))&lt;br /&gt;
			y = y + 2&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		inputString = p.Replace(inputString, search, replace)&lt;br /&gt;
	end&lt;br /&gt;
	return inputString&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.Replace(str, search, replace, num)&lt;br /&gt;
	-- replace key terms&lt;br /&gt;
	search = search:gsub(&amp;#039;{space}&amp;#039;, &amp;#039; &amp;#039;)&lt;br /&gt;
	replace = replace:gsub(&amp;#039;{space}&amp;#039;, &amp;#039; &amp;#039;):gsub(&amp;#039;{newline}&amp;#039;, &amp;#039;&amp;lt;br /&amp;gt;&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- result&lt;br /&gt;
	if lib.isNotEmpty(num) then&lt;br /&gt;
		local nums = {}&lt;br /&gt;
		local curr = 0&lt;br /&gt;
		for n in lib.gsplit(num, &amp;#039;,&amp;#039;) do &lt;br /&gt;
			if tonumber(n)~=nil then nums[tonumber(n)] = true end&lt;br /&gt;
		end&lt;br /&gt;
		str = str:gsub(search, function()&lt;br /&gt;
			curr = curr + 1&lt;br /&gt;
			if nums[curr] then return replace&lt;br /&gt;
			else return false end&lt;br /&gt;
		end)&lt;br /&gt;
		return str&lt;br /&gt;
	else&lt;br /&gt;
		return str:gsub(search, replace)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>ReisuDesign</name></author>
	</entry>
</feed>