<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_rep%2Fdoc</id>
	<title>Template:Str rep/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_rep%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Str_rep/doc&amp;action=history"/>
	<updated>2026-05-10T20:08:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Template:Str_rep/doc&amp;diff=40719&amp;oldid=prev</id>
		<title>73.70.189.118: Undid revision 1126990370 by 73.70.189.118 (talk)</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Str_rep/doc&amp;diff=40719&amp;oldid=prev"/>
		<updated>2022-12-12T08:58:03Z</updated>

		<summary type="html">&lt;p&gt;Undid revision 1126990370 by &lt;a href=&quot;/mediawiki/index.php/Special:Contributions/73.70.189.118&quot; title=&quot;Special:Contributions/73.70.189.118&quot;&gt;73.70.189.118&lt;/a&gt; (&lt;a href=&quot;/mediawiki/index.php?title=User_talk:73.70.189.118&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:73.70.189.118 (page does not exist)&quot;&gt;talk&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{lua|Module:String}}&lt;br /&gt;
{{used in system}}&lt;br /&gt;
&amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns a modified copy of a given text, with the &amp;#039;&amp;#039;&amp;#039;first&amp;#039;&amp;#039;&amp;#039; occurrence of a find-string replaced with a replacement-string.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
{{tlc|Str rep|&amp;#039;&amp;#039;text...&amp;#039;&amp;#039;|&amp;#039;&amp;#039;find-string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;replace-string&amp;#039;&amp;#039;}}{{br}}&lt;br /&gt;
&amp;lt;!--NO tlc here--&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{Str rep| 1=&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;text...&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt; | 2=&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;find-string&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt; | 3=&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;replace-string&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt; }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is equivalent to {{mlx|String|replace|3=source=&amp;#039;&amp;#039;text...&amp;#039;&amp;#039;|4=&amp;#039;&amp;#039;find-string&amp;#039;&amp;#039;|5=&amp;#039;&amp;#039;replace-string&amp;#039;&amp;#039;|6=1}}.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
There are three positional (unnamed) parameters, all required:&lt;br /&gt;
# the initial text string subject to search and replacement&lt;br /&gt;
# the find-string to search for in the text&lt;br /&gt;
# the replacement string: param&amp;amp;nbsp;3 replaces param&amp;amp;nbsp;2&amp;#039;s first occurrence in param&amp;amp;nbsp;1.&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&lt;br /&gt;
The value of the text parameter may be anything that resolves to a string, such as:&lt;br /&gt;
* Immediate text entered directly into the parameter field: {{tlc|str rep|Dogs chase cats.  Cats chase mice.|...}}&lt;br /&gt;
* A parameter passed from a transcluding template: {{tlc|str rep|&amp;lt;nowiki&amp;gt;{{{5|}}}&amp;lt;/nowiki&amp;gt;|...}} or {{tlc|str rep|&amp;lt;nowiki&amp;gt;{{{text|}}}&amp;lt;/nowiki&amp;gt;|...}}&lt;br /&gt;
* A file or template: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|{{Template:Str rep/doc/Dogs and cats}}|...}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* or anything else that resolves to a string.&lt;br /&gt;
&lt;br /&gt;
=== Equal signs and pipes ===&lt;br /&gt;
&lt;br /&gt;
Equal signs in parameter values passed as immediate text either [[Help:Template#Usage hints and workarounds|need to be escaped]] as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{=}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, or you can leave them unescaped and use the built-in numeric names ({{para|1}}, {{para|2}}, and {{para|3}}) for the three unnamed positional parameters, as in the section [[#Usage|usage]] at the top. &lt;br /&gt;
&lt;br /&gt;
Pipe characters in immediate text should be escaped either as &amp;lt;code&amp;gt;&amp;amp;amp;#124;&amp;lt;/code&amp;gt; or as {{tl|!}}. See [[Help:Template#Usage hints and workarounds]]. Pipe characters in embedded items such as params or template invocations don&amp;#039;t need to be escaped.&lt;br /&gt;
&lt;br /&gt;
=== White space ===&lt;br /&gt;
&lt;br /&gt;
Pay attention to the use of white space in the parameters; all white space is significant in positional parameters. In particular, [[Help:Template#Parameters|leading and trailing white space]] is not removed, and can affect the results. See contrasting [[#Examples|examples #1 and #2]] below.&lt;br /&gt;
&lt;br /&gt;
If you like the readability of having convenience blanks before and after the parameters so they&amp;#039;re not adjacent to the pipe characters, then use the [[Help:Template#Usage hints and workarounds|built-in numeric names]] {{para|1}}, etc. These will not include any leading or trailing blanks in the parameter value; see [[#Examples|example&amp;amp;nbsp;3]].&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|Dogs chase cats.|cats|balls}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{str rep|Dogs chase cats.|cats|balls}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|Dogs chase cats.|cats |balls }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{str rep|Dogs chase cats.|cats |balls }} &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;mdash;&amp;#039;&amp;#039;&amp;amp;nbsp;{{nay|8px}}&amp;amp;nbsp;leading and trailing blanks are significant; see [[#Details|Details]]&amp;#039;&amp;#039;&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|Dogs chase cats.|2=cats |3=balls }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{str rep|Dogs chase cats.|2=cats |3=balls }} &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;mdash;&amp;#039;&amp;#039;&amp;amp;nbsp;{{aye|8px}}&amp;amp;nbsp;... but not when named parameters are used&amp;#039;&amp;#039;&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|Dogs chase cats.  Cats chase mice.|chase|love}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{str rep|Dogs chase cats.  Cats chase mice.|chase|love}} &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;mdash;&amp;amp;nbsp;&amp;#039;&amp;#039;only first occurrence replaced&amp;#039;&amp;#039;&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{str rep|{{Str rep/doc/Dogs and cats}}|chase|love}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{str rep|{{Str rep/doc/Dogs and cats}}|chase|love}} &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;mdash;&amp;amp;nbsp;&amp;#039;&amp;#039;text can be entered by a template&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* {{tl|Replace}} - to replace &amp;#039;&amp;#039;all&amp;#039;&amp;#039; occurrences (or a specific number of occurrences)&lt;br /&gt;
&lt;br /&gt;
{{string-handling templates|IRL}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
&amp;lt;!-- CATEGORIES AND INTERWIKIS LINKS HERE, THANKS --&amp;gt;&lt;br /&gt;
[[Category:String manipulation templates|Replace, {{PAGENAME}}]]&lt;br /&gt;
&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>73.70.189.118</name></author>
	</entry>
</feed>