Extension talk:Replace Text/Archive 2018

Is there a way to search with back slashes (/) ?
For example, how would I search for the string "c:\" ? Kmacdowe (talk) 20:19, 29 January 2015 (UTC)


 * You actually have a forward slash in your section header. Anyway, I think you can do it by just escaping it with another backslash, like "\\". Yaron Koren (talk) 00:01, 30 January 2015 (UTC)

How to Use $1 replacer following by numbers?

 * What if I want to replace (\[\[|link=)2L\]\] to $12L]], with regex?
 * The extension assume $12 is the replacer, but I just want $1 to be the replacer. Boxsnake (talk) 04:01, 20 February 2015 (UTC)
 * Do not mind, I found the solution on my own. Leave this thread in case others with the same problem can benefit from this
 * Replace

(\[\[|link=)2L\]\]
 * With

${1}2L]]

Is there a way to replace with \n (newline)
Is there a way to use the ReplaceText extension to replace with the \n (newline) character? I get the literal '\n' as output every time I try to replace with \n. Yes, I have 'Use regular expressions' checked. Cmjohannes (talk) 03:20, 3 September 2015 (UTC)


 * Can't you just have a newline in the replacement string? That's why the text inputs are textareas instead of single-line inputs. Yaron Koren (talk) 12:53, 3 September 2015 (UTC)


 * That solves it. So what regex expressions will be evaluated in the replacement string? For example, why does $1 get evaluated as a regex "variable," but not evaluated as the literal '$1' string? Cmjohannes (talk) 15:38, 4 September 2015 (UTC)


 * I don't know - everything other than "\n", hopefully. I'm surprised that "\n" doesn't work when you check the "regex" box, but thankfully there's a backup for that one. Yaron Koren (talk) 15:59, 4 September 2015 (UTC)

Is there a way to find \n or .newline.?
I would like to find \]\]\n. The ReplaceText extension can find \]\] or the ReplaceText extension can find \n, but the only way I can find \]\]\n is to search \]\] followed by pressing enter in the 'Replace Text:' box. 'Use regular expressions' is checked, so why is white space being searched for? Also, \n\n cannot be found, when I know it exists. Is there some kind of hidden character at the end of line breaks on wiki pages? Cmjohannes (talk) 05:15, 5 September 2015 (UTC)


 * This seems like basically the same question as before - but yes, it could be that, instead of just "\n", it's "\r\n" or some such. Yaron Koren (talk) 13:12, 8 September 2015 (UTC)

Parameter $wgBotJobUserID
I replaced line 56 in SpecialReplaceText.php with these lines:

global $wgBotJobUserID; if (isset($wgBotJobUserID)) $replacement_params['user_id'] = $wgBotJobUserID; else $replacement_params['user_id'] = $this->getUser->getId;

This way you can define a $wgBotJobUserID (number, not name) in LocalSettings.php to hide all changes of the job.

--VolkoV (talk) 12:46, 8 October 2015 (UTC)


 * The idea makes sense, although - I assume you came up with the name "$wgBotJobUserID"? If it's specific to Replace Text, it should start with "$wgReplaceText" - "$wgReplaceTextUserID" might work. Although better yet, I would think, would be to have users set the username, not the ID, and then the code looks up the ID. Yaron Koren (talk) 14:19, 8 October 2015 (UTC)


 * Thanks! This worked great.  I used Extension:LookupUser to find the user ID of the bot I wanted to use.  Just wanted to specify that the line you replaced was: $replacement_params['user_id'] = $this->getUser->getId; (in case line 56 changes) --Potrod (talk) 03:38, 28 May 2016 (UTC)


 * VolkoV - thanks for the idea, and Potrod - thanks for the reminder. I just checked in some code to handle a new global variable, $wgReplaceTextUser - it takes in a username, not an ID. If you get the latest Replace Text code, it should work. Yaron Koren (talk) 19:40, 31 May 2016 (UTC)

Not here
Hi User:Yaron Koren, any particular reason why RT isn't available on this wiki? Thanks. --Elitre (WMF) (talk) 12:39, 22 February 2016 (UTC)


 * I don't know - I have no say in what gets installed on mediawiki.org. If I did, the site would probably look different. :) Yaron Koren (talk) 14:21, 22 February 2016 (UTC)

Is there any way to move pages from one NS to another?
Problem is: I need to move some bunch of pages from Namespace1:Somepagename to Namespace2:Somepagename

When I set replacement string to Namespace1 it says that no result was found, even if both NS was chosen (with or without regexp tick)

Is there any way to do such job using that extension? (btw, mediawiki 1.26.2, private  if that matters) Ibutakov.smartec (talk) 12:19, 18 March 2016 (UTC)


 * Ah, I hadn't realized (or forgot) that RT couldn't be used to modify the namespace. But that makes sense, because the "full name" of a page is not stored anywhere in the database. It would take a good amount of work to get RT to support this, unfortunately. Assuming you have a lot of pages like this, probably the easiest solution is to create a bot to do the replacement, if you know how to program. Yaron Koren (talk) 14:08, 18 March 2016 (UTC)

Disable Watchlist Notifications
Is it possible to block ReplaceText from sending watchlist notifications. In order for users to continue to see major updates they would have to go into each page when they get the emails after we run this script. In our case they may have to go into hundreds of pages. Jrsovereign (talk) 19:30, 4 April 2016 (UTC)


 * This is a tricky one - it appears to be possible to cancel the emailing for MW 1.23 and higher, thanks to a new hook in the code - but users who aren't watching hundreds or thousands of these pages may well want to be notified of Replace Text changes. If someone is watching that many pages, and gets emailed on watchlist changes, won't they be used to getting lots of emails? And if they see hundreds of new emails in a short amount of time, and they check and see that the first few are Replace Text-related, won't they be able to assume that the rest are as well? Yaron Koren (talk) 21:13, 4 April 2016 (UTC)


 * Yes, but regardless they still have to visit all the pages once again to get any additional notifications. Jrsovereign (talk) 21:49, 4 April 2016 (UTC)


 * Oh... now I get what you said; I didn't understand it before. Are you saying that, unless they view a page, users will stop getting emailed about changes to that page? I had no idea about that. Are you sure that that's the case? Do you know if there's any documentation about this? Yaron Koren (talk) 22:30, 4 April 2016 (UTC)


 * Yes here: Help:Watchlist: "After receiving an email notification for a page, you have to visit the page while logged in if you want to be notified of further changes to the same page." Jrsovereign (talk) 02:38, 5 April 2016 (UTC)