<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.geministation.com/index.php?action=history&amp;feed=atom&amp;title=Template%3AReplace%2Fdoc</id>
	<title>Template:Replace/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.geministation.com/index.php?action=history&amp;feed=atom&amp;title=Template%3AReplace%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.geministation.com/index.php?title=Template:Replace/doc&amp;action=history"/>
	<updated>2026-06-04T11:54:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.geministation.com/index.php?title=Template:Replace/doc&amp;diff=1951&amp;oldid=prev</id>
		<title>Banri: Created page with &quot;{{Documentation}} Acts as a regex-supporting version of &lt;code&gt;&lt;nowiki&gt;{{#replace:}}&lt;/nowiki&gt;&lt;/code&gt;.  Some functions of standard regex (Perl compatible) are not supported. * N...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.geministation.com/index.php?title=Template:Replace/doc&amp;diff=1951&amp;oldid=prev"/>
		<updated>2020-02-17T19:38:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Documentation}} Acts as a regex-supporting version of &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#replace:}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.  Some functions of standard regex (Perl compatible) are not supported. * N...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation}}&lt;br /&gt;
Acts as a regex-supporting version of &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#replace:}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Some functions of standard regex (Perl compatible) are not supported.&lt;br /&gt;
* No flags (&amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;)&lt;br /&gt;
* No alteration (&amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;); see below&lt;br /&gt;
* No generalized quantifier (&amp;lt;code&amp;gt;{m,n}&amp;lt;/code&amp;gt;)&lt;br /&gt;
* No word boundaries (&amp;lt;code&amp;gt;\b&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Lua&amp;#039;s pattern matching is used for this template; however, the following replacements are made to give some functionality to standard regex:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;*?&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;$1&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;%1&amp;lt;/code&amp;gt; (supported for all numbers 1–9)&lt;br /&gt;
&lt;br /&gt;
Any whitespace in the output will be automatically trimmed and condensed. Any HTML entities (such as &amp;lt;code&amp;gt;&amp;amp;amp;#39;&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{subst:PAGENAME}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;) will be automatically converted to their actual character.&lt;br /&gt;
&lt;br /&gt;
;Alteration&lt;br /&gt;
If detected, the module can emulate very simple alteration patterns within groups, with the following limitations:&lt;br /&gt;
* No supported for nested grouping (e.g. &amp;lt;code&amp;gt;(foo|bar(and|or)baz)&amp;lt;/code&amp;gt;&lt;br /&gt;
** Escaped parentheses should work properly inside grouping (e.g. &amp;lt;code&amp;gt;(foo|bar\(or\)baz)&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; will cause unwanted behaviour inside any groups, even if that group doesn&amp;#039;t use alteration&lt;br /&gt;
** This only applies to patterns where at least 1 group has an alteration. If all groups are single captures, this behaviour won&amp;#039;t occur.&lt;br /&gt;
* The pipe character breaks wikitext. Use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{!}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;¦&amp;lt;/code&amp;gt; inside patterns&lt;br /&gt;
&lt;br /&gt;
;MediaWiki docs&lt;br /&gt;
For full information on the difference between Lua&amp;#039;s pattern matching and regex, see [[mw:Extension:Scribunto/Lua reference manual#Patterns|Lua reference manual § Patterns]].&lt;br /&gt;
&lt;br /&gt;
;Usage&lt;br /&gt;
This template should always be substituted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{subst:replace|text to perform on|search pattern|replacement}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Examples&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{subst:replace|textcapturetext|text(.*)text|$1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;capture&amp;lt;/code&amp;gt;&lt;br /&gt;
::Expected: &amp;lt;code&amp;gt;capture&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{subst:replace|Abyssal whip detail.png|detail\.png}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;Abyssal whip&amp;lt;/code&amp;gt;&lt;br /&gt;
::Expected: &amp;lt;code&amp;gt;Abyssal whip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{replace|abcde|(ab¦c¦d)|^$1^}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;{{replace|abcde|(ab¦c¦d)|^$1^}}&amp;lt;/code&amp;gt;&lt;br /&gt;
::Expected: &amp;lt;code&amp;gt;^ab^^c^^d^e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{replace|abcde|(a¦b¦d)|$$1###-}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;{{replace|abcde|(a¦b¦d)|$$1###-}}&amp;lt;/code&amp;gt;&lt;br /&gt;
::Expected: &amp;lt;code&amp;gt;$a###-$b###-c$d###-e&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{replace|abcde|(ab¦a¦b)|!$1!}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;{{replace|abcde|(ab¦a¦b)|!$1!}}&amp;lt;/code&amp;gt;&lt;br /&gt;
::Expected: &amp;lt;code&amp;gt;!ab!cde&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;[[Category:Formatting templates]]&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Banri</name></author>
	</entry>
</feed>