<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Coderanger</id>
	<title>Kolmafia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Coderanger"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Special:Contributions/Coderanger"/>
	<updated>2026-04-25T03:32:25Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Replace_all&amp;diff=6533</id>
		<title>Replace all</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Replace_all&amp;diff=6533"/>
		<updated>2015-01-04T01:03:33Z</updated>

		<summary type="html">&lt;p&gt;Coderanger: Add note about $n.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|replace_all}}{{&lt;br /&gt;
#vardefine:return_type|string}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|matcher|pattern}}|&lt;br /&gt;
p1desc={{pspan|pattern}} is the regular expression to use|&lt;br /&gt;
parameter2={{Param|string|replacement}}|&lt;br /&gt;
p2desc={{pspan|replacement}} is used to replace any match of the pattern|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=This function first resets the matcher {{pspan|pattern}}. It then scans the input sequence looking for matches of the pattern. Characters that are not part of any match are appended directly to the result string with each match replaced by the replacement string. Captured groups can be used in the replacement string via $0, $1, etc.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Simple Example|&lt;br /&gt;
description=For example:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
string input = &amp;quot;aabfooaaaabfooabfoob&amp;quot;;&lt;br /&gt;
matcher test_match = create_matcher(&amp;quot;a*b&amp;quot;, input);&lt;br /&gt;
string result = replace_all(test_match, &amp;quot;-&amp;quot;);&lt;br /&gt;
print(result);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|&lt;br /&gt;
moreinfo=&lt;br /&gt;
Will result in the following being printed: &lt;br /&gt;
&amp;lt;pre&amp;gt;-foo-foo-foo-&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{SeeAlso|replace_first}}|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:String Handling Routines]]&lt;/div&gt;</summary>
		<author><name>Coderanger</name></author>
	</entry>
</feed>