Wikipedia:WikiProject User scripts/Scripts/Replace

This is an old revision of this page, as edited by ST47 (talk | contribs) at 01:05, 22 October 2007 (Protected Wikipedia:WikiProject User scripts/Scripts/Replace: protect against abuse - arbitrary code injection [edit=sysop:move=sysop] [cascading]). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

//

function wpTextboxReplace()
{
    var s = prompt("Search regexp:");
    if(s){
        var r = prompt("Replace /"+s+"/ with:");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "mg"), r);
    }
}
addOnloadHook(function () {
    if (document.forms.editform) {
        addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'Replace', 'ca-replace',
                       'Regexp replace for the edit window', 'R', document.getElementById('ca-history'));
    }
});

//

//