Forum:Bot search and replace

I'd like to replace all links in a wiki that look like this *PAGENAME at Tolkien Gateway with a template looking like this * The structure is always the same, but PAGENAME differs. Is that possible using AWB or Pywikipediabot? If so... how?

Thanks for your help. -- Weas-El ✉  15:02, November 3, 2011 (UTC)


 * At least for the template call, you should use the magic word . AWB may be able to do it, Pywikipedia could definitely have a script written for it that would allow it to perform that action if it doesn't already have the capability.


 * You could likely use AWB with a regular expression in order to express PAGENAME or at least to capture it in the find. Not sure on what it is you would use though.--


 * "PAGENAME" probably was a bad choice for my parameter name. This is just the name of the linked page, but not necessarily equal to.
 * @Godisme: What could that regex look like? The expressions don't have the same length... -- Weas-El ✉  15:15, November 3, 2011 (UTC)


 * I read some help pages now, but I wasn't able to figure out how to create an appropriate regular expression yet. It would be easier if the page title had always the same length. Do you know any experienced pywikipediabot users I could ask? -- Weas-El ✉  20:42, November 3, 2011 (UTC)

You might find the fixes.py script a useful source of advanced replacement examples. — Sovq 21:45, November 3, 2011 (UTC)