User:BrownHairedGirl/AWB modules/Replace title year or title decade in category redirects

This is a quick and dirty AWB custom module to replace title year or title decade in category redirects, to avoid the proem of Template:Resolve category redirect.

I used it for these edits. Feel free to use or modify it at your own risk.

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip) {   Skip = false;

string nuArticleText = ArticleText; string myTitleYearDec = ""; Match m = Regex.Match(ArticleTitle, @"^Category:(? \d\d\d(\d|0s)) ((dis)?establishments )?in "); if (m.Success) { myTitleYearDec = m.Groups["yeardec"].Value; }   else { Skip = true; Summary = ""; return ArticleText; }   m = Regex.Match(myTitleYearDec, @"0s$"); if (m.Success) { nuArticleText = Regex.Replace(ArticleText, @"\{\{\s*title\s*decade\s*\}\}s", myTitleYearDec, RegexOptions.IgnoreCase); }   else { nuArticleText = Regex.Replace(ArticleText, @"\{\{\s*title\s*year\s*\}\}", myTitleYearDec, RegexOptions.IgnoreCase); }

string oldredir = Regex.Replace(ArticleText, @"(?<!(year|decade))\}\}.+$", "}}", RegexOptions.Singleline); string nuredir = Regex.Replace(nuArticleText, @"\}\}.+$", "}}", RegexOptions.Singleline); Summary = oldredir + " → " + nuredir; return nuArticleText; }