<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>http://wiki.kyoshihira.uk/index.php?action=history&amp;feed=atom&amp;title=Module%3AStringReplace</id>
	<title>Module:StringReplace - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.kyoshihira.uk/index.php?action=history&amp;feed=atom&amp;title=Module%3AStringReplace"/>
	<link rel="alternate" type="text/html" href="http://wiki.kyoshihira.uk/index.php?title=Module:StringReplace&amp;action=history"/>
	<updated>2026-10-25T06:13:45Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://wiki.kyoshihira.uk/index.php?title=Module:StringReplace&amp;diff=1849&amp;oldid=prev</id>
		<title>Lhscogs：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="http://wiki.kyoshihira.uk/index.php?title=Module:StringReplace&amp;diff=1849&amp;oldid=prev"/>
		<updated>2025-06-28T17:08:00Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2025年6月28日 (六) 17:08的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Lhscogs</name></author>
	</entry>
	<entry>
		<id>http://wiki.kyoshihira.uk/index.php?title=Module:StringReplace&amp;diff=1848&amp;oldid=prev</id>
		<title>wikipedia&gt;Xiplus-abot：​已更改“Module:StringReplace”的保护等级：高風險模板：24829引用&lt;!-- 機器人3 --&gt;（[编辑=仅允许模板编辑员和管理员]（无限期）[移动=仅允许模板编辑员和管理员]（无限期））</title>
		<link rel="alternate" type="text/html" href="http://wiki.kyoshihira.uk/index.php?title=Module:StringReplace&amp;diff=1848&amp;oldid=prev"/>
		<updated>2020-08-17T04:13:41Z</updated>

		<summary type="html">&lt;p&gt;已更改“&lt;a href=&quot;/index.php/Module:StringReplace&quot; title=&quot;Module:StringReplace&quot;&gt;Module:StringReplace&lt;/a&gt;”的保护等级：高風險模板：24829引用&amp;lt;!-- &lt;a href=&quot;/index.php?title=User:Xiplus-abot/task/3&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Xiplus-abot/task/3（页面不存在）&quot;&gt;機器人3&lt;/a&gt; --&amp;gt;（[编辑=仅允许模板编辑员和管理员]（无限期）[移动=仅允许模板编辑员和管理员]（无限期））&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module for different search and replace operations on strings.&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Takes one string parameter, and returns the string with all characters with special meaning for Lua patterns escaped with a preceding `%`.&lt;br /&gt;
function p.escape_pattern(text)&lt;br /&gt;
    -- Replaces each occurrence of any of ().%+-*?[^$ with a `%` and then the character.&lt;br /&gt;
    local r = string.gsub(text, &amp;quot;[%(%)%.%%%+%-%*%?%[%^%$]&amp;quot;, &amp;quot;%%%1&amp;quot;)&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Returns the first parameter, with all occurrences of the second parameter replaced with the third parameter.&lt;br /&gt;
-- All special characters are ignored: {{#invoke:StringReplace|replace_all|test.a%1$foo|%1|bar}} results in `test.abarfoo`.&lt;br /&gt;
function p.replace_all(frame)&lt;br /&gt;
    local str = frame.args[1]&lt;br /&gt;
    local strToFind = frame.args[2]&lt;br /&gt;
    local strToreplaceWith = frame.args[3]&lt;br /&gt;
    local r = string.gsub(str, p.escape_pattern(strToFind), p.escape_pattern(strToreplaceWith))&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p[&amp;#039;encode wiki page name&amp;#039;] = function( frame )&lt;br /&gt;
	local x = mw.ustring.gsub( &lt;br /&gt;
		frame.args[1] or &amp;#039;&amp;#039;, &lt;br /&gt;
		&amp;#039;[\&amp;#039;&amp;quot;&amp;amp;_]&amp;#039;, &lt;br /&gt;
		{ &lt;br /&gt;
			[&amp;quot;&amp;#039;&amp;quot;] = &amp;#039;&amp;amp;#39;&amp;#039;, &lt;br /&gt;
			[&amp;#039;&amp;quot;&amp;#039;] = &amp;#039;&amp;amp;#34;&amp;#039;, &lt;br /&gt;
			[&amp;#039;&amp;amp;&amp;#039;] = &amp;#039;&amp;amp;#38;&amp;#039;, &lt;br /&gt;
			[&amp;#039;_&amp;#039;] = &amp;#039; &amp;#039;, &lt;br /&gt;
		} &lt;br /&gt;
	)&lt;br /&gt;
	return mw.text.trim( x )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Xiplus-abot</name></author>
	</entry>
</feed>