Wikipedia:Bots/Requests for approval/RockfangBot 5


 * The following discussion is an archived debate. Please do not modify it. Subsequent comments should be made in a new section. The result of the discussion was Symbol keep vote.svg Approved.

RockfangBot 5
Operator: Rockfang (talk)

Automatic or Manually Assisted: Automatic Supervised

Programming Language(s): AWB

Function Overview: Replace   with    on all talk pages that have.

Edit period(s): One time run.

Already has a bot flag (Y/N): Y

Function Details: Replace   with    on all talk pages that have  per this.

Discussion
Are these pages no longer going to be part of Wikiproject Europe? [[Sam Korn ]] (smoddy) 15:35, 1 March 2009 (UTC)
 * I've asked the person who requested the bot work to comment here.--Rockfang (talk) 18:20, 1 March 2009 (UTC)
 * Yes, they should be, we should add also. (Sorry for the oversight) PRODUCER (talk) 21:27, 1 March 2009 (UTC)
 * So the task is to add to every page that currently contains .  That sounds fairly easy and uncontroversial.  Will you be importing ,   and   from the Europe template?   [[Sam Korn ]] (smoddy) 22:35, 1 March 2009 (UTC)
 * Actually the task should be to add both and  to every page that currently contains  . —Preceding unsigned comment added by PRODUCER (talk • contribs) 00:28, March 2, 2009 (UTC)
 * With regards to the importing of, etc, I'm not sure how to do that with AWB yet, so I was going to do that with my main account after the bot part was done.  I know this wouldn't the efficient method possible, but it would work out in the end.--Rockfang (talk) 04:50, 3 March 2009 (UTC)
 * It's possible to copy and modify template parameters on AWB using regexp capture groups. Eg, the regexp find


 * (\{\{\s*WikiProject Europe([^{}]*?)\}\})


 * and replace with


 * $1\n


 * This copies all parameters of template:WikiProject Europe into the new instance of template:WikiProject Bosnia and Herzegovina. We then remove incompatible parameters from the latter template:


 * find:


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*Albania\s*=\s*\w*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*BiH\s*=\s*\w*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*ESA\s*=\s*\w*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*Slovenia\s*=\s*\w*([^{}]*?)\}\}


 * in all four cases replace with:




 * Erik9 (talk) 03:44, 6 March 2009 (UTC)
 * You should replace those last 4 finds with:
 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*(?:Albania|BiH|ESA|Slovenia)\s*=([^{}]*?)\}\}
 * ST47 (talk) 04:10, 6 March 2009 (UTC)
 * Only if you're sure that no more than one of the incompatible parameters can appear in template:WikiProject Bosnia and Herzegovina. Even if you are, you should at least use
 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*(?:Albania|BiH|ESA|Slovenia)\s*=\s*\w*([^{}]*?)\}\}
 * instead to remove the parameter text as well as the parameter itself. (I fixed this problem in my expressions as well.) Erik9 (talk) 04:27, 6 March 2009 (UTC)
 * Truth. How about:
 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*(?:Albania|BiH|ESA|Slovenia)\s*=[^|}]*([^{}]*?)\}\}
 * (Replaced the \w with anything except a | or a }) ST47 (talk) 04:32, 6 March 2009 (UTC)


 * ST47 (talk) 04:11, 6 March 2009 (UTC)
 * Thank you. I'll start the trial tomorrow.--Rockfang (talk) 17:41, 7 March 2009 (UTC)


 * I've tried the first step of replacing the template using  (\{\{\s*WikiProject Europe([^{}]*?)\}\})  and  $1\n . That part works fine.  But the 2nd step (removing the invalid parameters) isn't working.  It keeps leaving the "|Albania=yes" for example in the new template.  I've tried using a 2nd regular rule, and using a sub rule of the first one.  Neither works.  I'm a tad new at using both Regexp and multi rules in AWB with advanced find and replace.  Any suggestions?--Rockfang (talk) 23:05, 9 March 2009 (UTC)
 * Yes. Use
 * find:


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*Albania\s*=[^|}]*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*BiH\s*=[^|}]*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*ESA\s*=[^|}]*([^{}]*?)\}\}


 * \{\{\s*WikiProject Bosnia and Herzegovina([^{}]*?)\|\s*Slovenia\s*=[^|}]*([^{}]*?)\}\}


 * in all four cases replace with:




 * You must use all four regexp rules separately (and after the addition of template:WikiProject Bosnia and Herzegovina); otherwise, only one incompatible parameter can be removed, leaving you with |Albania=yes, etc. Of course, if you're using (\{\{\s*WikiProject Europe([^{}]*?)\}\}) => $1\n , then you need something along the lines of \{\{[^{}]*WikiProject Europe[^{}]*\|\s*BiH\s*=\s*yes[^{}]*\}\} as a "doesn't contain" skip criterion. Erik9 (talk) 03:05, 10 March 2009 (UTC)
 * Also, while "advanced" find and replace may or may not work correctly in applying the rules above, I confirmed their correct operation using "normal" find and replace (which allows regular expressions when the appropriate boxes are checked). Erik9 (talk) 03:29, 10 March 2009 (UTC)
 * Ok. I started the trial and stopped it after 31 edits.  I realised that I was forgetting the "skip on doesn't contain" part.  At first I assumed I'd need four skip lines.  One for each country.  But then I was thinking.  For the BiH part in:  \{\{[^{}]*WikiProject Europe[^{}]*\|\s*BiH\s*=\s*yes[^{}]*\}\}  couldn't I just use  \{\{[^{}]*WikiProject Europe[^{}]*\|\s*(Albania|BiH|ESA|Slovenia)\s*=\s*yes[^{}]*\}\}  instead?  Would that still work as a valid "skip on doesn't contain"?  FYI, I've reverted the 31 trial edits.--Rockfang (talk) 05:47, 10 March 2009 (UTC)
 * No. Recall that the task is to "Replace   with    on all talk pages that have  " (It was later clarified that  is added, but  is not removed.) Therefore, only uses of template:WikiProject Europe that have a "BiH=yes" parameter should be processed. As a result, you should use \{\{[^{}]*WikiProject Europe[^{}]*\|\s*BiH\s*=\s*yes[^{}]*\}\} as the only "doesn't contain" skip criterion, and should not attempt to create expressions to process talk pages by virtue of their inclusion of other regional parameters. The four regexps to remove each possible regional parameter do not imply that any of the parameters form suitable criteria for inclusion in bot processing, but only that other regional parameters should be removed when they are incidentally present along with "BiH=yes". Erik9 (talk) 23:23, 10 March 2009 (UTC)
 * Also, you should use \{\{[^{}]*WikiProject Bosnia and Herzegovina[^{}]*\}\} as a "contains" skip criterion to avoid adding template:WikiProject Bosnia and Herzegovina to talk pages which already have it. Erik9 (talk) 00:48, 11 March 2009 (UTC)
 * Gotcha. Thank you for the help with this.--Rockfang (talk) 02:14, 11 March 2009 (UTC)


 * The first 31 edits were a tad hosed. As I described above, I forgot the skip criterions, and it added the template to pages regardless if the page had the BiH parameter set or not.  Incorporating the above info from Erik9, I did the last 19 edits.--Rockfang (talk) 02:14, 11 March 2009 (UTC)

Approved for trial. - fix is evidently in, lets give it a shot -- Tawker (talk) 06:20, 16 March 2009 (UTC)
 * --Rockfang (talk) 03:29, 17 March 2009 (UTC)

BAGAssistanceNeeded--Rockfang (talk) 02:37, 23 March 2009 (UTC)
 * I think that all neccessary lessons have probably been learnt, and there's no reason not to approve for such a trivial task. - Jarry1250 (t, c) 17:02, 24 March 2009 (UTC)


 * The above discussion is preserved as an archive of the debate. Please do not modify it. Subsequent comments should be made in a new section.