<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=MyWiki%3AWikiProject_User_scripts%2FScripts%2FReplace</id>
	<title>MyWiki:WikiProject User scripts/Scripts/Replace - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=MyWiki%3AWikiProject_User_scripts%2FScripts%2FReplace"/>
	<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=MyWiki:WikiProject_User_scripts/Scripts/Replace&amp;action=history"/>
	<updated>2026-04-22T19:17:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>http://70.231.62.181/index.php?title=MyWiki:WikiProject_User_scripts/Scripts/Replace&amp;diff=8532638&amp;oldid=prev</id>
		<title>imported&gt;WOSlinker: change source to syntaxhighlight</title>
		<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=MyWiki:WikiProject_User_scripts/Scripts/Replace&amp;diff=8532638&amp;oldid=prev"/>
		<updated>2021-02-07T14:52:56Z</updated>

		<summary type="html">&lt;p&gt;change source to syntaxhighlight&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;// &amp;lt;syntaxhighlight lang=javascript&amp;gt;&lt;br /&gt;
// Adds a &amp;quot;Replace&amp;quot; tab which pops up two prompt boxes; one for a regexp and one for a replacement&lt;br /&gt;
function wpTextboxReplace()&lt;br /&gt;
{&lt;br /&gt;
    var s = prompt(&amp;quot;Search regexp:&amp;quot;);&lt;br /&gt;
    var txt = document.editform.wpTextbox1;&lt;br /&gt;
    while (true) {&lt;br /&gt;
        if (!s) return;&lt;br /&gt;
        var s_r = new RegExp(s, &amp;quot;mg&amp;quot;);&lt;br /&gt;
        if (s_r.test(txt.value)) {&lt;br /&gt;
            var r = prompt(&amp;quot;Replace /&amp;quot;+s+&amp;quot;/ with:&amp;quot;);&lt;br /&gt;
            r = r.replace(/\\n/g,&amp;quot;\n&amp;quot;); // unescape newlines&lt;br /&gt;
            if (!r &amp;amp;&amp;amp; r !== &amp;#039;&amp;#039;) return;&lt;br /&gt;
            txt.value = txt.value.replace(s_r, r);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            var s_0 = s;&lt;br /&gt;
            s = prompt(&amp;quot;/&amp;quot; + s_0 + &amp;quot;/ did not match anything. You may enter a new regexp:&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
addOnloadHook(function () {&lt;br /&gt;
    if (document.forms.editform) {&lt;br /&gt;
        mw.util.addPortletLink(&amp;#039;p-cactions&amp;#039;, &amp;#039;javascript:wpTextboxReplace()&amp;#039;, &amp;#039;Replace&amp;#039;, &amp;#039;ca-replace&amp;#039;,&lt;br /&gt;
                       &amp;#039;Regexp replace for the edit window&amp;#039;, &amp;#039;R&amp;#039;, document.getElementById(&amp;#039;ca-history&amp;#039;));&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
// &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// [[Category:Wikipedia scripts]]&lt;/div&gt;</summary>
		<author><name>imported&gt;WOSlinker</name></author>
	</entry>
</feed>