WikiFunctions.Parse.HideText ht = new WikiFunctions.Parse.HideText(true, false, true);
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = false;
Summary = "";
ArticleText = ht.Hide(ArticleText);
////User:Ohconfucius/AWB modules/dmy
// www. and http
ArticleText=Regex.Replace(ArticleText, @"(\|\s?(?:author(?:link\d?|)|author|chapter|first||journal|last||magazine|newspaper|publisher|title||website|work|via)\s*\=\s*)(?:w{3}\.)(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)https?:\/{2}(?:w{3}\.|)(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)(?:w{3}\.)(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:author(?:link\d?|)|chapter|journal|magazine|newspaper|publisher|title|work|via)\s*\=\s*)(\w+(?:\.(?:com?|net|org|gov|\w{2}))(?:\.\w{2}|))(?:\/[^|}]*|)(?=\s*[\]|}])", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(>{{cit[^}]+\|\s?website\s*\=\s*)https?:\/{2}(?:w{3}\.|)(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(>{{cit[^}]+\|\s?website\s*\=\s*)(?:w{3}\.)(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|df==y", "");
//protect dates
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[September)( 11 attacks\|)", "$1♫$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(100\s)(crore club\D)", "$1♫$2");
//fix common errors retrieved on
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*author[ ]*=[ ]*(?:))(?:[^|}]*)\d{4}, [\d\.:]{4,5}(?: |)[AP]M IST(?=\s*[|}])", "$1");
//rem superscripted ordinals
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)<sup>(th|st|nd|rd)<\/sup>", "$1$2");
//zap redundant {{date}}, {{accessdate}} {{retrieved}} and {{#dateformat}}
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{date\|((?:19|20)\d{2-[01]\d-[0-3]\d)[ ]*\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{date\|([0-3]\d[\-\s]\w+|\w+[\-\s][0-3]\d)[ ]*\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{date\|([^\{\}\|\-]+)(?:\|l?(?:[dmy]{3}|iso|none|link))?\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{accessdate\|((?:19|20)\d{2-[01]\d-[0-3]\d)[ ]*\}\}", "Retrieved $1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{retrieved[ ]*\|[ ]accessdate=([\-\w, ]*)\}\}", "Retrieved $1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{#dateformat:([^\{\}\|]+)(?:\|dmy|\|mdy)?\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date[ ]*[^\=][ ]*|\w{2,}[ ]*)\{\{(?:start|end).date[^|}]*\|((?:1[789]|20)\d{2})\}\}", "$1$2");
//stripping start/end template
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([12]?\d|30|31)(?:th|st|nd|rd|)(?:_| )(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)", "[[$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(?:_| )([12]?\d|30|31)(?:th|st|nd|rd|)", "[[$1 $2");
//month+day piped to month+day
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:[12]?\d|30|31)(?:th|st|nd|rd|)\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(\d{1,2}\s)(?:th|st|nd|rd|)(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]", "[[$1$2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(\d{1,2}\s)(?:th|st|nd|rd|)(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]", "[[$1$2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(\s\d{1,2})(?:th|st|nd|rd|)\]\]", "[[$1$2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(\s\d{1,2})(?:th|st|nd|rd|)\]\]", "[[$1$2]]");
//month+day piped to number
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:[12]?\d|30|31)(?:th|st|nd|rd|)\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(\d{1,4})\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(\d{1,4})\]\]", "[[$1]]");
//part dates
//remove leading zeros from dts templates
ArticleText=Regex.Replace(ArticleText, @"(?i)({{dts\d?\|[^}]*\|)0([^}]*}})", "$1$2");
//delink ISO dates
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([12]\d{3}-\d\d-\d\d)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([12]\d{3})\]\]-\[\[(\d\d-\d\d)\]\]", "$1-$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([12]\d{3})-\[\[(\d\d-\d\d)\]\]", "$1-$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([12]\d{3})\]\]-(\d\d-\d\d)", "$1-$2");
//remove dts1 template that links ISO dates
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{dts1\|(\d{4}-\d\d-\d\d)\}\}", "$1");
// solitary day_numbers
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2})(?:th|st|nd|rd)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2})(?:th|st|nd|rd)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,2}(?:st|nd|rd|th))\]\]", "$1");
//month+year
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4}#[^\|\]]+\|((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{3,4})\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{3,4})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d{3,4}\|([^\]]{1,30})\]\]", "$1");
//removed piped years when in full date
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[\d{1,2}\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s?\[\[)[^\|\]]{1,32}\|(\d{1,4}\]\])", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}\]\],?\s?\[\[)[^\|\]]{1,32}\|(\d{1,4}\]\])", "$1$2");
//Identify surprise or 'Easter egg' diversions linking months to year articles.
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4}#[^\|\]]+\|(January|February|March|April|May|June|July|August|September|October|November|December)\]\]", "$1");
//Month+day_number "March 7th" -> "March 7"
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d?\d)(?:th|st|nd|rd)\]\]", "[[$1 $2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d?\d)\]\](?:th|st|nd|rd)", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d?\d)(?:th|st|nd|rd)\s(January|February|March|April|May|June|July|August|September|October|November|December)\]\]", "$1 $2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\d?\d)(?:th|st|nd|rd|) (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)", "$1 $2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s* \s*((?:19\d|20[01])\d)(?=\D)", "$1 $2");
//(month yyyy-month yy)
ArticleText=Regex.Replace(ArticleText, @"(?i)\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(20)([01]\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([01]\d)\)", "($1 $2$3–$4 $2$5)");
ArticleText=Regex.Replace(ArticleText, @"(?i)\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(19)([3-9]\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([3-9]\d)\)", "($1 $2$3–$4 $2$5)");
ArticleText=Regex.Replace(ArticleText, @"(?i)\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(19)(9\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([01]\d)\)", "($1 $2$3–$4 20$5)");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|), ([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s[1-3]?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)", "$1, $2$3 $4");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s|[-–])([1-3]?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)", "$1$2$3 $4");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?:\sof\s?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=[^\|\]\w\d])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|),\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?=[^\]\|\w\d]\D)", "$1 $2, $3$4 $5");
ArticleText=Regex.Replace(ArticleText, @"(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?=[^\]\|\w\d]\D)", "$1 $2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-3]?\d)(?:th|st|nd|rd)(?=[^\]\|\w\d]\D)", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(\s*=\s*)((?:19|20)\d\d),?\s+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0?([1-2]?\d|3[01])(?=[\s\r\n]*[\|\}])", "$1$4 $3 $2");
ArticleText=Regex.Replace(ArticleText, @"(\s*\()((?:19|20)\d\d),?\s+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0?([1-2]?\d|3[01])(?=\))", "$1$4 $3 $2");
//Month+day_number piped into number. Preferences do not work. They don't work in sequence because digits in the two dates must be adjacent
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with ndash or mdash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with slash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?\-?\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with ndash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2})\]\]", "$1$2$3$4");
//same again but with slash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\/)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with ndash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with slash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with ndash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
//same again but with slash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{1,2}(?:th|st|nd|rd))\]\]", "$1");
//month+day piped into month+day or vice versa
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December))\]\]", "$1");
//4 digit years piped into 2
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4}\|(\d{1,2}(?:th|st|nd|rd))\]\]", "$1");
//full dates with incorrect 'year in'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s(?:[0-3][\d]|[\d])\]\]),\s\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:[0-3][\d]|[\d])\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])\s\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:[0-3][\d]|[\d])\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])\s{{(?:avyear|by|fy|ly|scy|sdy)\|(\d{1,4})}}", "$1 [[$2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s(?:[0-3][\d]|[\d])\]\]),\s\{\{(?:avyear|by|fy|ly|scy|sdy)\|(\d{1,4})\}\}", "$1 [[$2]]");
//insert comma to separate date from army unit
ArticleText=Regex.Replace(ArticleText, @"(?i)(January|February|March|April|May|June|July|August|September|October|November|December) (the \d\d*@th (?:Air(?:borne|)|Arm(?:ou?red|y)|Artillery|Battalion|Brigade|Co(?:mpan|)y|Division|Fleet|Group|Infantry|Land|Panzer|Regiment|Squadron|Sqn)\b)", "$1, $2");
// remove nowrap template from dm and md dates
ArticleText=Regex.Replace(ArticleText, @"(?i)(date=)\{\{(?:j|nowrap)\|(?:([0-2]?\d|30|31)(?:[ _]| )(January|February|March|April|May|June|July|August|September|October|November|December))\}\}", "$1$2 $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date=)\{\{(?:j|nowrap)\|(?:(January|February|March|April|May|June|July|August|September|October|November|December)(?:[ _]| )([0-2]?\d|30|31))\}\}", "$1$2 $3");
//remove leading zero from linked date
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s0(\d)(?:th|st|nd|rd|)\]\]", "[[$1 $2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]", "[[$1 $2]]");
//change deprecated birth and death templates
ArticleText=Regex.Replace(ArticleText, @"(?i)\|mf=ye?s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{\{(?:Birth|Death|launch|release|start|end|film date|Wayback)[^\}\|]*\|)", "$1df=yes|");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{\{(?:Birth|Death|launch|release|start|end|film date|Wayback)[^\}\|]*\|)df=ye?s?\|([^}]*df=ye?s?)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{\{(?:start.date|end.date)\|)df=ye?s?\|((?:1[789]|20)\d{2}\}\})", "$1$2");
// eliminating time of day
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*author[ ]*=[ ]*)(?:posted|published)(?: by| on)[\s:]\s*(?=\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)[0-2]?\d:[0-5]\d(?:[ ]| )(?:[ap]m |[ap]\.m\. |)([A-Z]{1,2}T|UTC)[\.,]?[ ]?", "$1");
// eliminating days of the week
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,?)\s", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:Mon|Tues?|Wed|Thur?|Fri|Sat|Sun)[\.,]?)\s", "$1");
// eliminating dates placed in author parameter
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*author\s*=\s*)@month @day,? @yyyy\s?(?:,? \d?\d:\d\d(?:\s*| )(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)\|", "|");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*author\s*=\s*)@day @month,? @yyyy\s?(?:,? \d?\d:\d\d(?:\s*| )(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)\|", "|");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Jan\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 January $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Feb\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 February $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Mar\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 March $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Apr\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 April $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) @Jun\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 June $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) (?:Jly|Jul\.?) ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 July $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Aug\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 August $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Sep. ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 September $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Oct\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 October $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Nov\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 November $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate)[ ]*=[ ]*)([1-9]|[1-2][0-9]|30|31) Dec\.? ([1-2][0-9]{3})(?=\s*[\|\}])", "$1$2 December $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Jan\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 January $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Feb\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 February $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Mar\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 March $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Apr\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 April $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Jun\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 June $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) (?:Jly|Jul\.?) ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 July $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Aug\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 August $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Sep. ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 September $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Oct\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 October $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Nov\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 November $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>(?:[^<]+?[\s\(]|))([1-9]|[1-2][0-9]|30|31) Dec\.? ([1-2][0-9]{3})(?=(?:[^\w\/\-%,<][^<]*?|)<\/ref>)", "$1$2 December $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Jan\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 January $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Feb\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 February $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Mar\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 March $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Apr\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 April $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Jun\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 June $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) (?:Jly|Jul\.?) ([1-2][0-9]{3})(?=\)\W)", "$1$2 July $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Aug\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 August $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Sep\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 September $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Oct\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 October $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Nov\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 November $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([ ]\()([1-9]|[1-2][0-9]|30|31) Dec\.? ([1-2][0-9]{3})(?=\)\W)", "$1$2 December $3");
//Slashes
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?1\/([12]\d{3})(?![\w\d-])", "$1 January $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?2\/([12]\d{3})(?![\w\d-])", "$1 February $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?3\/([12]\d{3})(?![\w\d-])", "$1 March $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?4\/([12]\d{3})(?![\w\d-])", "$1 April $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?5\/([12]\d{3})(?![\w\d-])", "$1 May $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?6\/([12]\d{3})(?![\w\d-])", "$1 June $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?7\/([12]\d{3})(?![\w\d-])", "$1 July $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?8\/([12]\d{3})(?![\w\d-])", "$1 August $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?9\/([12]\d{3})(?![\w\d-])", "$1 September $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/10\/([12]\d{3})(?![\w\d-])", "$1 October $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/11\/([12]\d{3})(?![\w\d-])", "$1 November $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/12\/([12]\d{3})(?![\w\d-])", "$1 December $2");
//2-digit year – UK style
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?1\/([4-9]\d)(?![\w\d-])", "$1 January 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?2\/([4-9]\d)(?![\w\d-])", "$1 February 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?3\/([4-9]\d)(?![\w\d-])", "$1 March 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?4\/([4-9]\d)(?![\w\d-])", "$1 April 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?5\/([4-9]\d)(?![\w\d-])", "$1 May 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?6\/([4-9]\d)(?![\w\d-])", "$1 June 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?7\/([4-9]\d)(?![\w\d-])", "$1 July 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?8\/([4-9]\d)(?![\w\d-])", "$1 August 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?9\/([4-9]\d)(?![\w\d-])", "$1 September 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/10\/([4-9]\d)(?![\w\d-])", "$1 October 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/11\/([4-9]\d)(?![\w\d-])", "$1 November 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/12\/([4-9]\d)(?![\w\d-])", "$1 December 19$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?1\/([01]\d)(?![\w\d-])", "$1 January 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?2\/([01]\d)(?![\w\d-])", "$1 February 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?3\/([01]\d)(?![\w\d-])", "$1 March 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?4\/([01]\d)(?![\w\d-])", "$1 April 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?5\/([01]\d)(?![\w\d-])", "$1 May 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?6\/([01]\d)(?![\w\d-])", "$1 June 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?7\/([01]\d)(?![\w\d-])", "$1 July 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?8\/([01]\d)(?![\w\d-])", "$1 August 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/0?9\/([01]\d)(?![\w\d-])", "$1 September 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/10\/([01]\d)(?![\w\d-])", "$1 October 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/11\/([01]\d)(?![\w\d-])", "$1 November 20$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\w-](?:1[3-9]|[2-3]\d))\/12\/([01]\d)(?![\w\d-])", "$1 December 20$2");
//numerical format with hyphens and dashes (dd-mm-yyyy) to dmy
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?1[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 January $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d)[\-–]0?2[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 February $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?3[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 March $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?4[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 April $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?5[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 May $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?6[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 June $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?7[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 July $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?8[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 August $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]0?9[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 September $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]10[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 October $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]11[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 November $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([0-2]?\d|30|31)[\-–]12[\-–]([1-2]\d{3})(?=\s*[\|\}])", "$1$2 December $3");
//improperly formatted access dates with endashes (yyyy–mm–dd) and/or missing zeros to ISO
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})[–—]([0-2]?\d)[–—]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$2-$3-$4"); //ndashes and emdashes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-(\d)-([0-2]\d|30|31)(?=\s*[\|\}])", "$1$2-0$3-$4"); //ndashes and emdashes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-([0-1]\d)-(\d)(?=\s*[\|\}])", "$1$2-$3-0$4"); //ndashes and emdashes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-(\d)-(\d)(?=\s*[\|\}])", "$1$2-0$3-0$4"); //ndashes and emdashes
//improperly formatted dates with endashes (yyyy–mm–dd) and/or missing zeros to dmy
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?1–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 January $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?2–([0-2]?\d)(?=\s*[\|\}])", "$1$3 February $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?3–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 March $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?4–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 April $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?5–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 May $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?6–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 June $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?7–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 July $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?8–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 August $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–0?9–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 September $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–10–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 October $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–11–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 November $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})–12–([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 December $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?1[\-–]([1-9])(?=\s*[\|\}])", "$1$3 January $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?2[\-–]([1-9])(?=\s*[\|\}])", "$1$3 February $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?3[\-–]([1-9])(?=\s*[\|\}])", "$1$3 March $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?4[\-–]([1-9])(?=\s*[\|\}])", "$1$3 April $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?5[\-–]([1-9])(?=\s*[\|\}])", "$1$3 May $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?6[\-–]([1-9])(?=\s*[\|\}])", "$1$3 June $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?7[\-–]([1-9])(?=\s*[\|\}])", "$1$3 July $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?8[\-–]([1-9])(?=\s*[\|\}])", "$1$3 August $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]0?9[\-–]([1-9])(?=\s*[\|\}])", "$1$3 September $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]10[\-–]([1-9])(?=\s*[\|\}])", "$1$3 October $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]11[\-–]([1-9])(?=\s*[\|\}])", "$1$3 November $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]12[\-–]([1-9])(?=\s*[\|\}])", "$1$3 December $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]1[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 January $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]2[\-–](0?[1-9]|[1-2]\d)(?=\s*[\|\}])", "$1$3 February $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]3[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 March $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]4[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 April $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]5[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 May $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]6[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 June $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]7[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 July $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]8[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 August $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]9[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 September $2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]10[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 October $2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]11[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 November $2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]12[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])", "$1$3 December $2");
//yyyymmdd_to_dmy
//code to convert ref ISO-dates outside citation templates
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-01-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 January $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-02-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 February $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-03-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 March $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-04-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 April $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-05-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 May $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-06-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 June $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-07-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 July $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-08-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 August $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-09-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 September $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-10-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 October $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-11-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 November $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-12-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 December $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-01-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 January $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-02-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 February $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-03-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 March $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-04-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 April $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-05-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 May $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-06-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 June $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-07-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 July $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-08-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 August $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-09-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 September $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-10-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 October $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-11-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 November $3$5$6");
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref.*?>[^<]+?)(\s\()([12]\d{3})-12-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)", "$1$2$4 December $3$5$6");
//convert md-mdy date ranges to dm-dmy
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([0-2]?\d|30|31)(?:th|st|nd|rd|)((?:,?\s[0-3]?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?(?:[-–]|–)\s?|\s(?:and|to|&)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(?:of\s|)(\d{3,4}\W\D)", "$1$3$4$5$6 $2 $7");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([0-2]?\d|30|31)(?:th|st|nd|rd|)((?:,?\s[0-3]?\d(?:th|st|nd|rd|)){0,6}), ([0-2]?\d|30|31)(?:th|st|nd|rd|)(?=\W\D|[ ]*\r)", "$1$3$4, $5 $2");
//convert md,d,d, date ranges to d,d,dm (multiple, separated by commas)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([1-2]?\d|30|31)(?:th|st|nd|rd|)((?:,?\s[0-3]?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?(?:[-–]|–)\s?|\s(?:and|to|&)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|)(?=\W\D|[ ]*\r)", "$1$3$4$5$6 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))((?:\s[1-3]?\d(?:th|st|nd|rd|),?){1,6})(\s(?:and|to|&|–)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|)(?=\W\D|[ ]*\r)", "$1$3$4$5 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([1-2]?\d|30|31)(?:th|st|nd|rd|)((?:,?\s[1-3]?\d(?:th|st|nd|rd|)){1,6})(?=\W\D|[ ]*\r)", "$1$3$4 $2");
//convert md date ranges to dm (simple, separated by hyphens and dashes or 'to')
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s?(?:[-–]|–)\s?|\sto\s)(?:\2\s|)([0-2]?\d|30|31)(?:th|st|nd|rd|)(?=\W\D|[ ]*\r)", "$1$3 $4$5 $2");
//'md, md,' to 'dm, dm,'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( [0-2]?\d|30|31),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( [0-2]?\d|30|31)([,\.]\W\D)", "$1$3$2,$5$4,$6");
//convert simple mdy dates to dmy
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE)\W\D)", "$1$3 $2 $4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s([12]\d{3})(?=\W\D|[ ]*\r)", "$1$3 $2 $4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([0-2]?\d|30|31)(?:th|st|nd|rd|)(?=\W\D|[ ]*\r)", "$1$3 $2");
//Month+day_number "March 7th" -> "March 7"
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)([0-2]?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|.)|Feb(?:ruary|.)|Mar(?:ch|.)|Apr(?:il|.)|May|June?|July?|Aug(?:ust|.)|Sep(?:tember|.)|Oct(?:ober|.)|Nov(?:ember|.)|Dec(?:ember|.))(\W\D)", "$1$2 $3$4");
//expand month names
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Jan (\d{4})", "$1 January $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Feb (\d{4})", "$1 February $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Mar (\d{4})", "$1 March $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Apr (\d{4})", "$1 April $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Jun (\d{4})", "$1 June $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Jul (\d{4})", "$1 July $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Aug (\d{4})", "$1 August $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Sep (\d{4})", "$1 September $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )Oct (\d{4})", "$1 October $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(date ?= ?[1-3]?\d )(Sept|Nov|Dec) (\d{4})", "$1 $2ember $3");
//remove leading zero from nonlinked date
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{4})(?=\W\D|[ ]*\r)", "$1$2 $3 $4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D\W)0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W\D|[ ]*\r)", "$1$2 $3");
//rem duplicated months in date formats //code not functioning as intended
ArticleText=Regex.Replace(ArticleText, @"(?i)([1-2]?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+(to|[\-–—])\s+([1-2]?\d|30|31)(?:th|st|nd|rd|)\s\2(?=\W)", "$1 $3 $4 $2");
//rem ordinals and redundant spaces (and commas) in date ranges
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D)0?([1-2]?\d|30|31)(?:th|st|nd|rd|)\s+(to|[\-–—])\s+0?([1-2]?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(?=\W)", "$1$2 $3 $4 $5");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D)0?([1-2]?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?),\s?(\d{3,4})(?=\W)", "$1$2 $3 $4");
//replace 'as of [date]' with 'updated [date]'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\'\')As of ([0-2]?\d|30|31)\s(Jan(?:uary|.)|Feb(?:ruary|.)|Mar(?:ch|.)|Apr(?:il|.)|May|June?|July?|Aug(?:ust|.)|Sep(?:tember|.)|Oct(?:ober|.)|Nov(?:ember|.)|Dec(?:ember|.))\s?(20\d{2})(?=\.?\')", "$1Updated $2 $3 $4");
// removing references to other WP articles and 'external' WP links
ArticleText=Regex.Replace(ArticleText, @"(?i)<ref>https?:\/\/\w{2}\.wik(?:ipedia|tionary)\.org\/wiki\/[^\s\]<]*<\/ref>", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)<ref>\[https?:\/\/\w{2}\.wik(?:ipedia|tionary)\.org\/wiki\/[^\s\]]*[ ]+[\w\d][^\]]*\]<\/ref>", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)[ ]\[https?:\/\/en\.wikipedia\.org\/wiki\/[^\s\]]*[ ]+([\w][^\]]*)\]", " [[$1]]");
//unprotect certain dates
ArticleText=Regex.Replace(ArticleText, @"(?i)(.)♫(.)", "$1$2");
//de-tagging for 'Use dmy dates|date='
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{(use (dmy|mdy) dates|dmy|mdy)(\|\s?cs1-dates=ly|)(\s*\|[^}]*)?\}\}\n?", "{{Use dmy dates|date=August 2024}}");
//ArticleText=Regex.Replace(ArticleText, @"\{\{[Rr]eflist\|\d\}\}", "{{reflist}}");
///General formatting
//adding piping to parentheticals
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([^\[\]\(\)\|:]*)[ _](\([^\[\]\(\)\|]*(?:album|band|born \d{4}|film|magazine|newspaper|song)\))(\]\])", "[[$1 $2|$1$3"); //adding piping to parentheticals
//Remove comma between month and year
ArticleText=Regex.Replace(ArticleText, @"(?i)(Jan(?:\.?|uary)|Feb(?:\.?|ruary)|Mar(?:\.?|ch)|Apr(?:\.?|il)|May|Jun(?:\.?|e)|Jul(?:\.?|y)|Aug(?:\.?|ust)|Sept?(?:\.?|ember)|Oct(?:\.?|ober)|Nov(?:\.?|ember)|Dec(?:\.?|ember)),\s(\d{4})", "$1 $2");
//improper capitalisation within section headings
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*External )(Links)(?=[ ]*=)", "$1links");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*See )(Also)(?=[ ]*=)", "$1also");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Box )O(ffice)(?=[ ]*=)", "$1o$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w]+? and )A(wards?|chievements?)(?=[ ]*=)", "$1a$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )A(lbums?)(?=[ ]*=)", "$1a$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )C(areer|haracters|ompositions)(?=[ ]*=)", "$1c$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )E(ducation)(?=[ ]*=)", "$1e$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )H(istory|onou?rs)(?=[ ]*=)", "$1h$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )L(evel|ife|isting)(?=[ ]*=)", "$1l$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:1st|2nd|3rd|\dth) )M(atch)", "$1m$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:1st|2nd|3rd|\dth) )F(inal)", "$1f$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:First|Second|Third|Fourth|[1-4](?:st|nd|rd|th)) )P(lace)(?=[ ]*==)", "$1p$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:First|Second|Third|Fourth|[1-4](?:st|nd|rd|th)) )Q(uarter)(?=[ ]*==)", "$1q$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:First|Second|Third|Fourth|[1-4](?:st|nd|rd|th)) )R(ound)(?=[ ]*==)", "$1r$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*(?:CFL|N[BFH]L) )C(oaching )[Rr](ecords?)(?=[ ]*=)", "$1c$2r$3");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )R(ankings?|eading|esults?|eception|ecognition)(?=[ ]*=)", "$1r$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[-\w\s]+? )C(areer )S(tatistics)(?=[ ]*=)", "$1c$2s$3");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )S(eason|quad|tyle|tage|tatistics)(?=[ ]*=)", "$1s$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )P(ersonnel)(?=[ ]*=)", "$1p$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )R(esponses?)(?=[ ]*=)", "$1p$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )T(ournaments?)(?=[ ]*=)", "$1t$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*[\w\s]+? )Y(ears)(?=[ ]*=)", "$1y$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Exhibition )S(chedule)(?=[ ]*=)", "$1s$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Regular )Season Schedule(?=[ ]*=)", "$1season schedule");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Right )[Oo]f Reply(?=[ ]*=)", "$1of reply");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Terminated )D(estinations)(?=[ ]*=)", "$1d$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Twin )T(owns)(?=[ ]*=)", "$1t$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Twin )(Towns [Aa]nd [Ss]ister [Cc]ities)(?=[ ]*=)", "$1towns and sister cities");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Heraldic )(Items)(?=[ ]*=)", "$1items");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Campaign )C(redits)(?=[ ]*=)", "$1c$2");
ArticleText=Regex.Replace(ArticleText, @"(==[ ]*Combat )C(hronicle)(?=[ ]*=)", "$1c$2");
//other improper capitalisation
ArticleText=Regex.Replace(ArticleText, @"([ ]*(?:\d\d?\W |)(?:CD |Cassette ))S(ingles?)\b", "$1s$2");
ArticleText=Regex.Replace(ArticleText, @"([ ]*(?:\d\d?\W |CD |Cassette ))S(ingles?)\b", "$1s$2");
ArticleText=Regex.Replace(ArticleText, @"\b(Bowling |Batting )S(tyle)\b", "$1s$2");
ArticleText=Regex.Replace(ArticleText, @"\b(lef|righ)t-Handed Opening B(atsman)\b", "$1t-handed opening b$2");
ArticleText=Regex.Replace(ArticleText, @"\b(lef|righ)t-Handed Top Order B(atsman)\b", "$1t-handed top-order b$2");
ArticleText=Regex.Replace(ArticleText, @"\b([Aa]ll)[- ]R(ounder)\b", "$1-r$2");
ArticleText=Regex.Replace(ArticleText, @"\b(Wicket)[- ]K(eeper)\b", "$1-k$2");
ArticleText=Regex.Replace(ArticleText, @"\b(fast)[-– ](medium )B(owler)\b", "$1–$2b$3");
ArticleText=Regex.Replace(ArticleText, @"\b([Ff]ast |[Mm]edium )B(owler)\b", "$1b$2");
ArticleText=Regex.Replace(ArticleText, @"\b([Ff]ast|[Ss]low)[-– ](lef|righ)t-[Aa]rm B(owler)\b", "$1 $2-arm b$3");
ArticleText=Regex.Replace(ArticleText, @"\b(fast)[- ]B(owler)\b", "$1-b$2");
ArticleText=Regex.Replace(ArticleText, @"\b([Ll]eg|[Oo]ff)[- ][Ss](pin )B(owler)\b", "$1-s$2b$3");
ArticleText=Regex.Replace(ArticleText, @"\b(st|nd|rd|th) G(rade)\b", "$1 g$2");
ArticleText=Regex.Replace(ArticleText, @"(\'Further )R(eading)(?=\')", "$1r$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )A(nd|t) A(n? \w)", "$1a$2 a$3");
ArticleText=Regex.Replace(ArticleText, @"(\w )A(nd|t) (My \w)", "$1a$2 $3");
ArticleText=Regex.Replace(ArticleText, @"(\w )A(nd|t) T(he \w)", "$1a$2 t$3");
ArticleText=Regex.Replace(ArticleText, @"(\w )By A(n? \w)", "$1by a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )By (My \w)", "$1by $2");
ArticleText=Regex.Replace(ArticleText, @"(\w )By T(he \w)", "$1by t$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )For A(n? \w)", "$1for a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )For (My \w)", "$1for $2");
ArticleText=Regex.Replace(ArticleText, @"(\w )For T(he \w)", "$1for t$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )In A(n? \w)", "$1in a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )In (My \w)", "$1in $2");
ArticleText=Regex.Replace(ArticleText, @"(\w )In T((?:he|o) \w)", "$1in t$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )I(nto \w)", "$1i$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )O(f|n|r) A(n? \w)", "$1o$2 a$3");
ArticleText=Regex.Replace(ArticleText, @"(\w )O(f|n|r) (My \w)", "$1o$2 $3");
ArticleText=Regex.Replace(ArticleText, @"(\w )O(f|n|r) T(he \w)", "$1o$2 t$3");
ArticleText=Regex.Replace(ArticleText, @"(\w )To A(n? \w)", "$1to a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )To (My \w)", "$1to $2");
ArticleText=Regex.Replace(ArticleText, @"(\w )To T(he \w)", "$1to t$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )With A(n? \w)", "$1with a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )With M(y \w)", "$1with M$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )With T(he \w)", "$1with t$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )A(t \w)", "$1a$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )I(n \w)", "$1i$2");
ArticleText=Regex.Replace(ArticleText, @"(\w )O([fn] \w)", "$1o$2"); //'Or' - false positive (with heraldric Or); 'On' - name (e.g. Ma On Shan)
ArticleText=Regex.Replace(ArticleText, @"(Bring |Turn )[Ii]t o(n)", "$1It O$2"); //reverting proper name - title of song or work
ArticleText=Regex.Replace(ArticleText, @"(Carry )o(n [A-Z]\w*|n film)", "$1O$2"); //reverting proper name - 'Carry On' film series
ArticleText=Regex.Replace(ArticleText, @"(Ma )o(n Shan)", "$1O$2"); //reverting proper name - 'Ma On Shan'
ArticleText=Regex.Replace(ArticleText, @"(NZ |New Zealand )o(n Air|n Screen)", "$1O$2"); //reverting proper name - 'NZ On Air'
ArticleText=Regex.Replace(ArticleText, @"in t(he [Aa]ir [Tt]onight)", "In t$1"); //reverting per "In the Air Tonight"
ArticleText=Regex.Replace(ArticleText, @"in t(he Flesh [Tt]our)", "In t$1"); //reverting per "In the Flesh tour"
ArticleText=Regex.Replace(ArticleText, @"(\W)o(n This Day)", "$1O$2"); //reverting per "on This Day"
ArticleText=Regex.Replace(ArticleText, @"(Star Trek )into( Darkness)", "$1Into$2"); //reverting proper name - title of work
//remove scroll bar for reflists
ArticleText=Regex.Replace(ArticleText, @"(?i)(References ?={1,4}[\n\r][\r\n\s]*)<div class=[^>]*>([\S\s]*?)<\/div>", "$1$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)((?:Notes ?|References ?)={2,4}\s?[\n\r][\r\n\s]*)(?:\{\{[Rr]eflist\|[2,3]\}\})", "$1{{reflist|colwidth=30em}}");
//rem redundant spaces underlining and punctuation
ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)[“](\[?\w+)", "$1\"$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\w+\]?)(,|\.|)[”](\W)", "$1\"$2$3"); //quotemark plus incidental LQ
ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)[‘`´’](\[?\w+)", "$1\'$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\w+\]?\.?)[‘`´’](\W)", "$1\'$2"); // replace various single quotes and prime symbol with straight apostrophe
ArticleText=Regex.Replace(ArticleText, @"(?i)([\w;,\]\)>] ) +([\[\w(])", "$1$2"); //rem multiple spaces except when preceded by full stop
ArticleText=Regex.Replace(ArticleText, @"(?i)(^\.U\.)[ ]+((?:S|K)\.)", "$1$2"); //U. S. and U. K. to U.S. and U.K.
ArticleText=Regex.Replace(ArticleText, @"(?i)(<\/?ref(?: name=[^\<\>\/]*?|)>)[ ,\. ]*(<ref)", "$1$2"); // remove punctuation between ref tags
ArticleText=Regex.Replace(ArticleText, @"(?i)[ ]{1,3}(<\/?ref(?:>| >| n))", "$1"); // remove spaces preceding ref tags and templates
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d), ([12]\d{3}\b)+", "$1, $2"); //removes nbsp preceding year
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?: | )%", "$1%"); //removes nbsp preceding '%'
ArticleText=Regex.Replace(ArticleText, @"(?i)( )[ ](–|–)", "$1$2"); //Palliative for dashes script insertion of space after nbsp
ArticleText=Regex.Replace(ArticleText, @"\b(US|UK|A(?:US|)|C(?:AN|)|NZ|HK) ([$£¥€])(\d)", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"\{\{AUD\}\} ?(\d+)", "A$ $1");
ArticleText=Regex.Replace(ArticleText, @"([$£¥€]) (\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(\{\{(?:INR|Indian Rupee)\}\}|Rs\.?)(\d+)", "$1 $2");
//rem bolding from linked AND bolded terms
// ArticleText=Regex.Replace(ArticleText, @"'''(\[\[)([^\|\]]+?\||)([^\]]+?\]\][:-–]?)'''", "$1$2$3");
//rem 'external' wiktionary links
ArticleText=Regex.Replace(ArticleText, @"(?i)\[https?:\/\/en\.wiktionary\.org\/wiki\/[\w]*[ ](\w[^\]]*)\]", "$1");
//rem leading and lagging spaces within wikilinks
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)[ ]+([^\[\]\|]*?)[ ]*(\]\])", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)[ ]*([^\[\]\|]*?)[ ]+(\]\])", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[[^\[\]\|]*?[ ])[ ]+([^\[\]]*?\]\])", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[[^\[\]\|]*?)[ ]+\|[ ]*([^\[\]]+\]\])", "$1|$2");
//symbol for 'times' and dashes
// ArticleText=Regex.Replace(ArticleText, @"(?i)×", "×");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) x (\d )", "$1 × $2");
ArticleText=Regex.Replace(ArticleText, @"\s(A[cglmrstu]|B[ahikrad]?|C[adeflmno]|D[bsyrsu]|E[rsu]|F[elmr]?|G[adef]|H[fgos]|I[nr]?|Kr?|L[aruv]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]?|U[ub][neopst]|V|W|Xe|Yb?|Z[nr])-(Br|Cl?|F|H|I|N|O|P|Se?)\s", " $1–$2 "); //signifying chemical bonds abbrev
ArticleText=Regex.Replace(ArticleText, @"(?i)—", "—");
ArticleText=Regex.Replace(ArticleText, @"(?i)([\w\d]) — (?=[\w\d])", "$1 – "); // tweak to avoid replacing emdashes in strings that are in non-roman unicode characters
ArticleText=Regex.Replace(ArticleText, @"(?i)(\D7\d7)–(\d(?:00|)\D)", "$1-$2"); //airplane model numbers taking hyphen
//inserting a white space between wikilinks to avoid errors upon unlinking
ArticleText=Regex.Replace(ArticleText, @"(?i)(\]\][\.,]?)(\[\[)(?!file|image)", "$1 $2");
//full stop and nbsp fixes
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:kw)\b", "$1 kW");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:khz)\b", "$1 kHz");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:m[Hh]z)\b", "$1 MHz");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:g[Hh]z)\b", "$1 GHz");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:kph|kphr|kmh|kmhr|kmph|kmphr|km\/hr)\b", "$1 km/h");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:m\.p\.h\.)\b", "$1 mph");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(gm|kg|km)s?\b", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*KMs?\b", "$1 km");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*KGs?\b", "$1 kg");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*(?:K(g|m))s?\b", "$1 k$2");
ArticleText=Regex.Replace(ArticleText, @"(\d\.\d?\d| \d{1,3}| \d{1,3},\d{3})[ ]*cms?", "$1 cm");
//turn letter 'x' into symbol '×'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\sx\s(\d{1,3})\sin\s\(", "$1 × $2 in (");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\sx\s(\d{1,3})\sinch\s", "$1 × $2 inch ");
// Convert degree symbols into ° symbol, ensure preceding space
ArticleText=Regex.Replace(ArticleText, @"°", "°");
// ArticleText=Regex.Replace(ArticleText, @"º", "°");
// Celsius spelling errors
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:celsius|celcius|centigrade)", "Celsius");
//Celsius or Fahrenheit
ArticleText=Regex.Replace(ArticleText, @"(\d) (?:[°º]|deg|degree|degrees) ([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:[°º]|deg|degree|degrees) ([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d) (?:[°º]|deg|degree|degrees)([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:\s|)(?:[°º]|deg|degree|degrees)(?:\s|)([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:\s| )?(?=\[\[Celsius\|[°º]C\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:\s| )?(?=\[\[Fahrenheit\|[°º]F\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(-?\d[\d,\.]*)(?:\s|-| |)[°º]F([:;,\.?!]?\s[^\d\(\)\/\\])", "$1{{convert|$2|°F|°C|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(-?\d[\d,\.]*)(?:\s|-| |)(?:deg|degree|degrees)(?:\s|-| |)Fahrenheit([:;,\.?!]?\s[^\d\(\)\/\\])", "$1{{convert|$2|°F|°C}}$3");
//remove commas from numerical values in convert template
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{convert\|\d+),(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{convert\|\d+),(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{convert\|\d+),(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{convert\|\d+),(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{convert\|\d+),(\d)", "$1$2");
//remove leading zeros from convert template
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{\{convert\s*\|)\s*0+(?=[1-9])", "$1$2");
///per WP:COMMONALITY
ArticleText=Regex.Replace(ArticleText, @"(?i)([Ff])reshman (year)", "$1irst $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([Ss])ophomore (album|year)", "$1econd $2");
//Currency notation placements [$£₤¥€]
ArticleText=Regex.Replace(ArticleText, @"(?i)\s(\$(?:\d+\.\d\d?|\d{1,3}|\d{1,3},\d{3}))((?:\s| )(?:m|b|tr)illion|)[ ]*(?:US(?:[D$]|\s?dollars?))\b", " US$1$2");
///dashes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|(?:1[89]|20)\d{2})-(\d{2}\]\])", "$1–$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[1[89]\d{2})-(\d{2}\D)", "$1–$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[20[01]\d)-([012]\d\D)", "$1–$2");
// removing external links within publisher/journal/work fields
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:newspaper|work|journal|publisher)\s*\=\s*)\[https?:\/\/[^\s\]]*\s([\w\d][^\]]*)\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?author(?:link\d?|)\s*\=\s*)\[https?:\/\/[^\s\]]*\s([\w\d][^\]]*)\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:newspaper|work|journal|publisher|author)\s*\=\s*)www\.([\w\d][^\|\}]*)(?=[\|\}])", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?author(?:link\d?|)\s*\=\s*)www\.([\w\d][^\|\}]*)(?=[\|\}])", "$1$2");
//citation template fixes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?)published\s?=", "$1publisher=");
// rem copyright assertion
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?publisher\s*\=\s*)(?:\[\[copyright(?:\|©|)\]\])\s?", "$1"); //54
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?publisher\s*\=\s*)(?:©|copyright)\s?", "$1");
// rem toggles and redundant quote marks
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:agency|author|newspaper|work|journal|publisher)\s*\=\s*)\'\'([^\|\}]+)\'\'(?=\s*[\}\|])", "$1$2"); //without link
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:agency|author|newspaper|work|journal|publisher)\s*\=\s*)\'\'(\[\[(?:[^\|]+\||)[^\|\]]+\]\])\'\'(?=\s*[\}\|])", "$1$2"); //with link
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?title\s*\=\s*)\''([^\|\{\}]+)\''", "$1$2"); //rem ' in titles
// Sources NZ Limited Viacom International Nine Media Corporation Turner Broadcasting System, Inc., Herald and Times Group
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*publisher\s*\=\s*)\((\[\[[^\|\{\}]+)(\|[^\]]*|)(\]\])\)", "$1$2$3$4"); //rem parenthetical publishers (1373)
// ArticleText=Regex.Replace(ArticleText, @"(\|\s*publisher\s*\=\s*)\"([^\|\{\}]+)\"", "$1$2"); //rem quote marks around publishers
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)ABP Group(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)ABP Group\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)All Media Network(\|[^\]]+|)(\]\])\s?", ""); //3009
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)All Media Network\s?", ""); //855
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)APN News & Media(?: Limited| Ltd\.?|)(\|[^\]]+|)(\]\])\s?", ""); //419 (334)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)APN (?:Holdings(?: NZ|)|News & Media)(?: Limited| Ltd\.?|)\s?", ""); //(119)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)British Sky Broadcasting|BSkyB|Sky(?: Digital|)(?: \(UK (?:and|&) Ireland\)| \(United Kingdom\)| \(?UK\)?)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)British Sky Broadcasting|BSkyB|Sky(?: Digital|)(?: \(UK (?:and|&) Ireland\)| \(United Kingdom\)| \(?UK\)?)\s?", ""); //1764
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Bauer (?:Consumer Media(?: Ltd\.?|)|Media(?: Group|)|Publishing(?: Group|)|Verlag)(\|[^\]]+|)(\]\])\s?", ""); //204
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Bauer (?:Consumer Media(?: Ltd\.?|)|Media(?: Group|)|Publishing(?: Group|)|Verlag)\s?", ""); //293
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Billboard Publi(?:cations|shing Company)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Billboard Publi(?:cations|shing Company)\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Bonnier Corporation(\|[^\]]+|)(\]\])\s?", ""); //60
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Bonnier Corporation\s?", ""); //455
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)CBS Interactive(?:[, ] ?Inc\.|)?(\|[^\]]+|)(\]\])\s?", ""); //(10,332) rs
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)CBS Interactive(?:[, ] ?Inc\.|)?\s?", ""); //(4330) rs
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Cond[eé] Nast(\|[^\]]+|)(\]\])\s?", ""); //1433
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Cond[eé] Nast\s?", ""); //1871
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)encyclop(?:æ|a|e)(?:e|)dia Britannica(?:[ ,] ?Inc\.?| \(?company\)?)(\|[^\]]+|)(\]\])\s?", ""); //(425)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)encyclop(?:æ|a|e)(?:e|)dia Britannica(?:[ ,] ?Inc\.?| \(?company\)?)\s?", ""); //(1374)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Fairfax(?: Digital| New Zealand| Media| NZ|NZ News|)(?: Limited| Ltd\.?|)\s?(?!a-zA-Z)(\|[^\]]+|)(\]\])\s?", ""); //2,716 (2761)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Fairfax(?: Digital| New Zealand| Media| NZ| NZ News|)(?: Limited| Ltd\.?|)\s?(?!a-zA-Z)", ""); //3,874 (3866)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Fandango(?:\.com| \(?(?:website|ticket service|media,?(?: LLC\.?|)))(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Fandango(?:\.com| \(?(?:website|ticket service|media,?(?: LLC\.?|)))", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*(?:agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Google (?:Books?|Livres?|Böcker|Boeken|Knihy|Książki|Sách)(?: Archive|)|books\.google\.com)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*(?:agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Google (?:Books?|Livres?|Böcker|Boeken|Knihy|Książki|Sách)(?: Archive|)|books\.google\.com)", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:Guardian News(?:papers| (?:&|and) Media|)(?: Limited| Ltd\.?|)|Guardian Media Group)(\|[^\]]+|)(\]\])\s?", ""); //1,916
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Guardian News(?:papers| (?:&|and) Media|)(?: Limited| Ltd\.?|)|Guardian Media Group)\s?", ""); //3151
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Hachette (?:Filipacchi|Magazines)(?: M[eé]dias?| Magazines|)(?:, S\.?A\.?| \(?UK\)?(?: Ltd\.?|)|)(\|[^\]]+|)(\]\])\s?", ""); //715
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Hachette (?:Filipacchi|Magazines)(?: M[eé]dias?| Magazines|)(?:, S\.?A\.?| \(?UK\)?(?: Ltd\.?|)|)\s?", ""); //163
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:The |)Hearst (?:Communications?(?:(?:,|) Inc\.?|)|Corporation|Newspapers(?:, LLC\.?|)|Entertainment|Magazines(?: UK|)|Publi(?:cations|shing)|UK|\(?media\)?)(\|[^\]]+|)(\]\])\s?", ""); //1661 1830 2837
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:The |)Hearst (?:Communications?(?:(?:,|) Inc\.?|)|Corporation|Newspapers(?:, LLC\.?|)|Entertainment|Magazines(?: UK|)|Publi(?:cations|shing)|UK|\(?media\)?)\s?", ""); //1116 1783 1783
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:IPC Media(?: Ltd\.?|)|TI Media|Future plc)(\|[^\]]+|)(\]\])\s?", ""); //6134
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:IPC Media(?: Ltd\.?|)|TI Media|Future plc)\s?", ""); //1264
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:(?:Independent|London) Print (?:Limited|Ltd\.?)|Independent(?: Digital|) News (?:and|&) Media(?: Ltd\.?| Limited| Group| Plc|))(?:\|[^\]]+|)(\]\])\s?", ""); //660
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:(?:Independent|London) Print (?:Limited|Ltd\.?)|Independent(?: Digital|) News (?:and|&) Media(?: Ltd\.?| Limited| Group| Plc|))\s?", ""); //1031
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:The |)Mirror Group(\|[^\]]+|)(\]\])\s?", ""); //
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:The |)Mirror Group\s?", ""); //
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:News Corp(?:oration|) ?Australia(?: Network|)|Australian Provincial Newspapers|News(?: Limited| Ltd\.?))(\|[^\]]+|)(\]\])\s?", ""); //1893 rs
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:News Corp(?:oration|) ?Australia(?: Network|)|Australian Provincial Newspapers|News(?: Limited| Ltd\.?))\s?", ""); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Newsquest(?: Media Group|)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Newsquest(?: Media Group|)\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:A\.C\. |The |)Nielsen(?: Company| Business Media(?:, Inc\.?|)| Online| Holdings(?: N\.V\.| PLC|)| N\.V\.| Co\.)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:A\.C\. |The |)Nielsen(?: Company| Business Media(?:, Inc\.?|)| Online| Holdings(?: N\.V\.| PLC|)| N\.V\.| Co\.)\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Nine (?:Entertainment|Publishing)(?: Co(?:\.|rporation|)|)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Nine (?:Entertainment|Publishing)(?: Co(?:\.|rporation|)|)\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:News Corp(?:oration| Australia(?: Network|)|)|News(?: Limited| Ltd\.?)|Australian Provincial Newspapers)\s?", ""); //2697
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:Northern ?(?:and|&) ?shell(?: Media|\.co\.uk|)|(?:The |)Express Newspapers)(\|[^\]]+|)(\]\])\s?", ""); //319
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Northern ?(?:and|&) ?shell(?: Media|\.co\.uk|)|(?:The |)Express Newspapers)\s?", ""); //156
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:Penske(?: Business|) Media,? (?:Corp\.?(?:oration|)|Media|)(?:LLC\.?|)|PMC \(company\))(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Penske(?: Business|) Media,? (?:Corp\.?(?:oration|)|Media|)(?:LLC\.?|)|PMC \(company\))\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Prometheus Global Media(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Prometheus Global Media\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Reach plc(\|[^\]]+|)(\]\])\s?", ""); //288
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Reach plc\s?", ""); //144
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Rovi Corp(?:oration|\.|)(\|[^\]]+|)(\]\])\s?", ""); //3386
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Rovi Corp(?:oration|\.|)\s?", ""); //4,421
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)SPIN ?Media(?: LLC|)(\|[^\]]+|)(\]\])\s?", ""); //38 rs
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)SPIN ?Media(?: LLC|)\s?", ""); //695
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:Telstra(?: Global|\.net| Media| BigPond| Corp(?:\.|oration)(?: Limited| Ltd\.)|)|BigPond)(\|[^\]]+|)(\]\])\s?", ""); //1126
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Telstra(?: Global|\.net| Media| BigPond| Corp(?:\.|oration)(?: Limited| Ltd\.)|)|BigPond)\s?", ""); //734
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Telegraph Media Group(?: Limited| Ltd\.?|)(\|[^\]]+|)(\]\])\s?", ""); //706
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Telegraph Media Group(?: Limited| Ltd\.?|)\s?", ""); //1,356
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:The |)Herald and Weekly Times(\|[^\]]+|)(\]\])\s?", ""); //419
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:The |)Herald and Weekly Times\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)The Hindu Group(\|[^\]]+|)(\]\])\s?", ""); //183
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)The Hindu Group\s?", ""); //69
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:The |)Scotsman Publications(?: Ltd\.?|)(\|[^\]]+|)(\]\])\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:The |)Scotsman Publications(?: Ltd\.?|)\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:Bennett, Coleman & Co\.?(?: Ltd.?|)|(?:The |)Times(?: of India|) Group)(\|[^\]]+|)(\]\])\s?", ""); //183
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Bennett, Coleman & Co\.?(?: Ltd.?|)|(?:The |)Times(?: of India|) Group)\s?", ""); //69
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)(?:News(?: Group Newspapers| International(?: Ltd|)| Intl| UK)|Times (?:Newspapers(?: Ltd\.?| Limited|)))(\|[^\]]+|)(\]\])\s?", ""); //183
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:News(?: Group Newspapers| International(?: Ltd|)| Intl| UK)|Times (?:Newspapers(?: Ltd\.?| Limited|)))\s?", ""); //69
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(\[\[)Toronto Star Newspapers[ ,](?: ?Ltd\.?|)(\|[^\]]+|)(\]\])\s?", ""); //0
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Toronto Star Newspapers[ ,](?: ?Ltd\.?|)\s?", ""); //194
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)\(?(\[\[)Trinity Mirror(\|[^\]]+|)(\]\])\)?\s?", ""); //1200
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)\(?Trinity Mirror\)?\s?", ""); // (1,792)
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)\(?(\[\[)(?:Jann Wenner|Wenner Media)(?: LLC\.?|)(\|[^\]]+|)(\]\])\)?\s?", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)(?:Jann Wenner|Wenner Media)(?: LLC\.?|)\s?", ""); //
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)\(?(\[\[)Yorkshire Post Newspapers(?: Ltd\.?|)(\|[^\]]+|)(\]\])\)?\s?", ""); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Yorkshire Post Newspapers(?: Ltd\.?|)\s?", ""); // 24
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)\(?(\[\[)Zink Media(?:(?:,|) Inc\.?|)(\|[^\]]+|)(\]\])\)?\s?", ""); //10
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher(\s*=\s*)Zink Media(?:(?:,|) Inc\.?|)\s?", ""); // sc
//Asia
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Al(?:-| |)j[ae]zeera(?: |'|)(?:\(?Arabic\)?|News|Television|TV|\.net|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Al Jazeera$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Al(?:-| |)j[ae]zeera(?: |'|)(?:\(?Arabic\)?|News|Television|TV|\.net|\.com|)", "publisher$2Al Jazeera");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)(?:The ?|)(?:Hindu ?|)Business ?Line(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3Business Line$4|location=Chennai");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(?:The ?|)(?:Hindu ?|)Business ?Line(?:\.com|)", "$1$2Business Line|location=Chennai");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)Business Line", "work$2$3Business Line");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)dawn ?(dawn|\(?newspaper\)?|\(?pakistan\)?|, karachi|\.com)(?:\|[^\]]+|)(\]\])", "newspaper$2Dawn|location=Pakistan");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)dawn ?(?:dawn|\(?newspaper\)?|\(?pakistan\)?|, karachi|\.com|)", "newspaper$2Dawn|location=Pakistan");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)deccan ?chronicle(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3Deccan Chronicle$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)deccan ?chronicle(?:\.com|)", "$1$2Deccan Chronicle");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Deccan Chronicle", "work$2$3Deccan Chronicle");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)(?:the ?|)Hindustan ?times(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3Hindustan Times$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(?:the ?|)Hindustan ?times(?:\.com|)", "$1$2Hindustan Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)Hindustan Times", "work$2$3Hindustan Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Telegraph(?: of Calcutta| \(?(?:Indian Newspaper|India|Calcutta|Kolkatt?a)\)?|India\.com|, Calcutta)(?:\|[^\]]+|)(\]\])", "$1$2The Telegraph|location=India");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |\w+\.|)economic ?times(?:\.indiatimes|)(?:\.com|(?: of|) \(?India\)?|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Economic Times$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |\w+\.|)economic ?times(?:\.indiatimes|)(?:\.com|(?: of|) \(?India\)?|)", "$1$2The Economic Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)The Economic Times", "work$2$3The Economic Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Telegraph(?: of Calcutta| \(?(?:Indian Newspaper|India|Calcutta|Kolkatt?a)\)?|India\.com|, Calcutta)", "$1$2The Telegraph|location=India");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Hindu|the|) ?Hindu(?:\.com| \(?(?:newspaper|online)\)?|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Hindu$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Hindu|the|) ?Hindu(?:\.com| \(?(?:newspaper|online)\)?|)", "$1$2The Hindu");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Hindu", "work$2$3The Hindu");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:the |)(?:Jpost|jerusalem ?post)(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Jerusalem Post$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Jpost|jerusalem ?post)(?:\.com|)", "$1$2The Jerusalem Post");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Jerusalem Post", "work$2$3The Jerusalem Post");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:\w+\.|)philstar(?:\.com|)|(?:The |)Philippine Star)(?:\|[^\]]+|)(\]\])", "$1$2$3The Philippine Star$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:\w+\.|)philstar(?:\.com|)|(?:The |)Philippine Star)", "$1$2The Philippine Star");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)The Philippine Star", "work$2$3The Philippine Star");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |\w+\.|)Times ?of ?India(?:\.com|\.indiatimes\.com|)|India Times)(?:\|[^\]]+|)(\]\])", "$1$2$3The Times of India$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:The |\w+\.|)Times ?of ?India(?:\.com|\.indiatimes\.com|)|India Times)", "$1$2The Times of India");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Times of India", "work$2$3The Times of India");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:the |)Times ?of ?israel(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Times of Israel$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:the |)Times ?of ?israel(?:\.com|)", "$1$2The Times of Israel");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Times of Israel", "work$2$3The Times of Israel");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)xinhua ?(?:General News Service|(?:News|Press) ?(?:Agency|Service|)|net(?:\.com|)|)(?:\|[^\]]+|)(\]\])", "agency$2$3Xinhua News Agency$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:\w+\.|)xinhua ?(General News Service|(?:News|Press) ?(Agency|Service|)|net(?:\.com|)|)", "agency$2Xinhua News Agency");
//Australia
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Nine(?:msn|)|9news) ?(?:\.com\.au|MSN|)(?:\|[^\]]+|)(\]\])", "publisher$2$3 9news.com.au$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Nine(?:msn|)\b|9news) ?(?:\.com\.au|MSN|)", "publisher$2 9news.com.au");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:ABC News(?: \(?Australia\)?| Online)|Australian Broadcasting Corporation News)(?:\|[^\]]+|)(\]\])", "publisher$2ABC News|location=Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:ABC News(?: \(?Australia\)?| Online)|Australian Broadcasting Corporation News)(?:\.com|)(?=[\|\s}])", "publisher$2ABC News|location=Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:abs\.gov\.au|Australian Bureau of Statistics)(?:\|[^\]]+|)(\]\])", "publisher$2$3Australian Bureau of Statistics$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:abs\.gov\.au|Australian Bureau of Statistics)", "publisher$2Australian Bureau of Statistics");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:ABC ?(?:\(?Australian Broadcasting Corporation\)?|\(?Australian television\)?|\(?Australia\)?|Online|\.net\.au|)|Australian? ?Broadcast(?:ing|) (?:Corporation \(ABC\)|Corp(?:oration|)|Commission))(?:\|[^\]]+|)(\]\])", "publisher$2$3Australian Broadcasting Corporation$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:ABC ?(?:\(?Australian Broadcasting Corporation\)?|\(?Australian television\)?|\(?Australia\)?|Online|\.net\.au)|Australian? ?Broadcast(?:ing|) (?:Corporation \(ABC\)|Corp(?:oration|)|Commission))", "publisher$2Australian Broadcasting Corporation");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)n(ine|ews)\.?com\.?au(?:\|[^\]]+|)(\]\])", "publisher$2$3N$4.com.au$5");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)n(ine|ews)\.?com\.?au", "publisher$2N$3.com.au");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:ABC|Australian Broadcasting Corporation) (?:RN|Radio National)(?:\|[^\]]+|)(\]\])", "publisher$2$3Radio National$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:ABC|Australian Broadcasting Corporation) (?:RN|Radio National)", "publisher$2Radio National");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Stuff(?:\.co\.nz| Ltd\.?| Limited| \(?(?:Company|Fairfax|website)\)?| New Zealand| NZ)(?:\|[^\]]+|)(\]\])", "publisher$2Stuff|location=New Zealand");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Stuff(?:\.co\.nz| Ltd\.?| Limited| \(?(?:Company|Fairfax|website)\)?| New Zealand| NZ)", "publisher$2Stuff|location=New Zealand");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Daily ?Telegraph(?: \(?(?:Australia|Sydney)\)?|\.com\.au)(?:\|[^]]+|)?(\]\])", "$1$2The Daily Telegraph|location=Sydney");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Daily ?Telegraph(?: \(?(?:Australia|Sydney)\)?|\.com\.au)", "$1$2The Daily Telegraph|location=Sydney");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)(?:New Zealand ?|N\.? ?Z\.? ?)Herald(?:\.co\.nz| News|)(?:\|[^\]]+|)(\]\])", "$1$2$3The New Zealand Herald$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)(?:New Zealand ?|N\.? ?Z\.? ?)Herald(?:\.co\.nz| News|)", "$1$2The New Zealand Herald");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The New Zealand Herald", "work$2$3The New Zealand Herald");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The|) ?Sydney Morning(?: |-)Herald|smh(?:\.com\.au|))(?:\|[^\]]+|)(\]\])", "$1$2$3The Sydney Morning Herald$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:The|) ?Sydney Morning(?: |-)Herald|smh(?:\.com\.au|))", "$1$2The Sydney Morning Herald"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Sydney Morning Herald", "work$2$3The Sydney Morning Herald");
//Canada
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:canada\.ca|Government of Canada)(?:\|[^\]]+|)(\]\])", "publisher$2$3Government of Canada$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:canada\.ca|Government of Canada)", "publisher$2Government of Canada");
//Entertainment
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)All ?movie(?:\.com| ?Guide|)(?:\|[^\]]+|)(\]\])", "publisher$2$3AllMovie$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)All ?movie(?:\.com| ?Guide|)", "publisher$2AllMovie");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)All(?: |-|)Music(?: ?Guide|\.com|)(\]\]|)[\.,]? \(?(\[\[|)Rovi Corp\.?(oration|)(\]\]|)\)?", "publisher$2$3AllMusic$4"); //1,329
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)All(?: |-|)Music(?: ?Guide|\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3AllMusic$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)All(?: |-|)Music(?: ?Guide|\.com|)", "publisher$2AllMusic");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)billboard(?:'s| \(?(?:magazine|website|newspaper|magazine)\)?|\.(?:com|biz))(?:\|[^\]]+|)(\]\])", "magazine$2Billboard");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Billboard(?:\.com|\.biz| magazine|)", "magazine$2Billboard");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Billboard", "work$2$3Billboard");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Box ?Office ?India)(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Box Office India$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Box ?Office ?India)(?:\.com|)", "publisher$2Box Office India");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Box ?Office ?Mojo(?: \(?website\)?|\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Box Office Mojo$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Box ?Office ?Mojo(?: \(?website\)?|\.com|)", "publisher$2Box Office Mojo");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:bpi\.co\.uk|British Phonographic Institute)", "publisher$2British Phonographic Industry");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)digital ?spy(?:\.co\.uk|\.com(?:\.au|)|\.ie|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Digital Spy$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)digital ?spy(?:\.co\.uk|\.com(?:\.au|)|\.ie|)", "publisher$2Digital Spy");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Discogs(?:\.com|\.org|\.co\.uk|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Discogs$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Discogs(?:\.com|\.org|\.co\.uk|)", "publisher$2Discogs");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Fandango(?:\.com| Media, LLC| Media| \(?(?:movies|website|ticket service|company)\)?)(?:\|[^\]]+|)(\]\])", "publisher$2$3Fandango Media$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Fandango(?:\.com| Media, LLC| Media| \(?(?:movies|website|ticket service|company)\)?)", "publisher$2Fandango Media");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |m\.|)(?:IMDB|Internet ?Movie ?Data ?Base)(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3IMDb$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |m\.|)(?:IMDB|Internet ?Movie ?Data ?Base)(?:\.com|)", "publisher$2IMDb");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)IMDb(\]\]|)''", "$1IMDb$2"); // 602
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)itunes(?: Music Store| Plus| \(?store\)?s?|)(?:\|[^\]]+|)(\]\])", "publisher$2$3iTunes Store$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)itunes (?:music |)stores?", "publisher$2iTunes Store");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[?\[?)itunes\.apple(?:\.com?|)(?:\.[\w]{2}|)(\]?\]?)", "publisher$2$3iTunes Store$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)MTV( \w+|)(?:\.com| \((?:Music Television|TV Channel)\)|)(?:\|[^\]]+|)(\]\])", "publisher$2$3MTV $4$5");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)MTV( \w+|)(?:\.com| \((?:Music Television|TV Channel)\)|)", "publisher$2MTV $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)MTV(\]\]|)''", "$1MTV$2"); // 1,083
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)Metacritic(?:\.com|)(\]\]|)\.? \(?(\[\[|)CBS Interactive(\]\]|)\)?", "publisher$2$3Metacritic$4"); //494
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Metacritic(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Metacritic$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Metacritic(?:\.com|)", "publisher$2Metacritic");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:New Musical Express|N ?M ?E(?:\.com| \(?(?:magazine|website|Japan|Australia|Asia)\)?|))(?:\|[^\]]+|)(\]\])", "$1$2$3NME$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:New Musical Express|N ?M ?E(?:\.com| \(?(?:magazine|website|Japan|Australia|Asia)\)?|))", "$1$2NME");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)NME", "work$2$3NME");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Official(?: UK|) ?Charts?(?: Company|\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Official Charts Company$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Official(?: UK|) ?Charts?(?: Company|\.com|)", "publisher$2Official Charts Company");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:People ?(?:\(?magazine\)?|\(?American magazine\)?|))(?:\.com|\.co\.uk|weekly|)(?:\|[^\]]+|)(\]\])", "$1$2$3People (magazine)|People$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:People ?(?:\(?magazine\)?|\(?American magazine\)?|))(?:\.com|\.co\.uk|weekly|)", "$1$2People");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)People", "work$2$3People");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:R\.?I\.?A\.?A\.?|Recording Industry Association of America|Recording Industry of America)(?:\|[^\]]+|)(\]\])", "publisher$2$3Recording Industry Association of America$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:R\.?I\.?A\.?A\.?(?:\.com|)|Recording Industry Association of America|Recording Industry of America)", "publisher$2Recording Industry Association of America");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)robertchristgau\.com", "publisher$2robertchristgau.com");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Rolling ?Stone(?:\.com| \(?magazine\)?|)(?:\|[^\]]+|)(\]\])", "$1$2$3Rolling Stone$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Rolling Stone(?:\.com| \(?magazine\)?|)", "$1$2Rolling Stone");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Rolling Stone", "work$2$3Rolling Stone");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)rotten(?: |-|)tomatoe?s(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Rotten Tomatoes$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)rotten(?: |-|)tomatoe?s(?:\.com|)", "publisher$2Rotten Tomatoes");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)\bSpin(?:\.com| \(?(?:magazine|website)|\)?)\b(?:\|[^\]]+|)(\]\])", "$1$2$3Spin (magazine)|Spin$4"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\bSpin(?:\.com| \(?(?:magazine|website)|\)?)\b", "$1$2Spin"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Spin\b", "work$2$3Spin"); //sc
//Sports
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)AFL(?:\.com\.au| Media)(?:\|[^\]]+|)(\]\])", "publisher$2$3AFL Media$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)AFL(?:\.com\.au| Media)", "publisher$2AFL Media");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Cricket?Archive(?:\.co(?:m|\.uk)|)(?:\|[^\]]+|)(\]\])", "publisher$2$3CricketArchive$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Cricket?Archive(?:\.co(?:m|\.uk)|)", "publisher$2CricketArchive");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:ESPN(?!\.)(?: \(?United States\)?|)|Entertainment and Sports Programming Network)(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPN$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:ESPN(?!\.)(?: \(?United States\)?|)|Entertainment and Sports Programming Network)", "publisher$2ESPN");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)\bespn(?:\.com|\.co\.uk|)\b(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPN$4"); //3016
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\bespn(?:\.com|\.co\.uk|)\b", "publisher$2ESPN"); //20604
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)\bESPN\b(\]\]|)''", "$1ESPN$2"); //745
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:ESPN|) ?cricinfo(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPNcricinfo$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:ESPN|) ?cricinfo(?:\.com|)\s*", "publisher$2ESPNcricinfo"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)ESPNcricinfo(\]\]|)''", "$1ESPNcricinfo$2"); //?
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:espn)? ?scrum(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPNscrum$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:espn)? ?scrum(?:\.com|)", "publisher$2ESPNscrum");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)ESPNscrum(\]\]|)''", "$1ESPNscrum$2"); //?
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)\bespn ?FC(?:\.com|\.co\.uk|)\b(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPN FC$4"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\bespn ?FC(?:\.com|\.co\.uk|)\b", "publisher$2ESPN FC"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)\bespn ?Deportes(?:\.com|\.co\.uk|)\b(?:\|[^\]]+|)(\]\])", "publisher$2$3ESPN Deportes$4"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\bespn ?Deportes(?:\.com|\.co\.uk|)\b", "publisher$2ESPN Deportes"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:FIFA(?:\.com|))|Federation of International Football Association)(?:\|[^\]]+|)(\]\])", "publisher$2$3FIFA$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:FIFA(?:\.com|))|Federation of International Football Association)", "publisher$2FIFA");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)FIFA(\]\]|)''", "$1FIFA$2"); //?
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Fox ?Sports(?:\.com\.au| \(?Australia\)?)", "publisher$2Fox Sports|location=Australia"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)Fox ?Sports(?:\.com|)", "publisher$2$3Fox Sports"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)Fox ?Sports(?:\.com\.au| \(?Australian TV network| \(?Australia\)?)(?:\|[^\]]+|)(\]\])", "publisher$2Fox Sports|location=Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)Fox ?Sports(?:\.com\.au| \(?Australian TV network| \(?Australia\)?)", "publisher$2Fox Sports|location=Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Goal ?\(?(?:\.com|website)\)?(?:\|[^\]]+|)(\]\])", "publisher$2$3Goal (website)|Goal$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Goal ?\(?(?:\.com|website)\)?", "publisher$2Goal");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Football Association of (?:Ireland|the Irish Free State)|FAI(?:\.ie|))(?:\|[^\]]+|)(\]\])", "publisher$2$3Football Association of Ireland$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Football Association of (?:Ireland|the Irish Free State)|FAI\b(?:\.ie|))", "publisher$2Football Association of Ireland");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)(?:NRL|National Rugby League)(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3National Rugby League$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |\w+\.|)(?:NRL|National Rugby League)(?:\.com|)", "publisher$2National Rugby League");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:RSSSF|Rec\.Sport\.Soccer Statistics Foundation)(?:\.com|\.org|)(?:\|[^\]]+|)(\]\])", "publisher$2$3RSSSF$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:RSSSF|Rec\.Sport\.Soccer Statistics Foundation)(?:\.com|\.org|)", "publisher$2RSSSF"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Rugby League Project|rugbyleagueproject(?:\.org|\.com))", "publisher$2Rugby League Project");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)\b(\s*=\s*)(\[\[)Sky ?Sports(?:\.com|\.co\.uk|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Sky Sports$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Sky ?Sports(?:\.com|\.co\.uk|)(?=[\]|\s}\n])", "publisher$2Sky Sports");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:SI|Sport'?s ?Illustrated)(?:\.com| \(?Magazine\)?|)(?:\|[^\]]+|)(\]\])", "$1$2$3Sports Illustrated$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\b(?:SI|Sport'?s ?Illustrated)\b(?:\.com| \(?Magazine\)?|)", "$1$2Sports Illustrated");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Sports Illustrated", "work$2$3Sports Illustrated");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)(?:The Cricketer|Cricketer \(?magazine\)?|thecricketer\.com)(?:\|[^\]]+|)(\]\])", "$1$2$3The Cricketer$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(?:The Cricketer|Cricketer \(?magazine\)?|thecricketer\.com)", "$1$2The Cricketer");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)The Cricketer", "work$2$3The Cricketer");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:UEFA|Union of European Football Associations|United European Football Association)(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3UEFA$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:UEFA|Union of European Football Associations|United European Football Association)(?:\.com|)(?=[\|\s}])", "publisher$2UEFA");
//United States
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)ABC ?News(?:(?:\.go|)\.com| \(?United States\)?|)(?:\|[^\]]+|)(\]\])", "publisher$2ABC News|location=United States");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)ABC ?News(?:(?:\.go|)\.com| \(?United States\)?|)", "publisher$2ABC News|location=United States");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Amazon(?:\.com\.au|\.com|\.co\.jp|\.fr|\.de|\.co\.uk| \((?:Company|website|retailer)\)?| books| Japan| UK| Inc\.?| Germany| India|, Inc\.|)(?:\|[^\]]+|)(\]\])", "publisher$2Amazon");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Amazon(?:\.com\.au|\.com|\.co\.jp|\.fr|\.de|\.co\.uk| \((?:Company|website|retailer)\)?| books| Japan| UK| Inc\.?| Germany| India|, Inc\.|)", "publisher$2Amazon");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Amnesty(?:\.org| International)(?:\|[^\]]+|)(\]\])", "publisher$2$3Amnesty International$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Amnesty(?:\.org| International)", "publisher$2Amnesty International");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)(?:AP|Associated Press)(?: (?:News|Online)|\.org|News\.com|)(?:\|[^\]]+|)(\]\])", "agency$2$3Associated Press$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)(?:\bAP\b|Associated Press)(?: (?:News|Online)|\.org|News\.com|)", "agency$2Associated Press");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)(?:Associated Press|AP)(\]\]|)''", "$1Associated Press$2"); //3,010
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*publisher\s*=\s*(\[\[|)ABC News(\]\]|)\s*)\|\s*publisher\s*=\s*(\[\[|)(?:American|Australian) Broadcasting Corporation(\]\]|)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher\s*=\s*(\[\[|)(?:American|Australian) Broadcasting Corporation(\]\]|)\s*(\|\s*publisher\s*=\s*(\[\[|)ABC News(\]\]|))", "$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)bloomb[eu]rg(?! News)(?:\.com| L\.P\.|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Bloomberg News$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)bloomb[eu]rg(?! News)(?:\.com| L\.P\.|)(?! b)", "publisher$2Bloomberg News");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Bloomberg(?: Business|) News(?:\|[^\]]+|)(\]\])", "publisher$2$3Bloomberg News$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Bloomberg(?: Business|) News", "publisher$2Bloomberg News");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Bloomb[eu]rg|) ?Business ?week(?:\.com| Online| Magazine|)(?:\|[^\]]+|)(\]\])", "$1$2$3Bloomberg Businessweek$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Bloomb[eu]rg|) ?Business ?week(?:\.com| Online| Magazine|)", "$1$2Bloomberg Businessweek");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Bloomb[eu]rg BusinessWeek", "work$2$3Bloomberg Businessweek");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)(?:Central ?Intelligence ?Agency|C\.? ?I\.? ?A\.?)(?:\.gov|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Central Intelligence Agency$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(?:Central ?Intelligence ?Agency|C\.? ?I\.? ?A\.?)(?:\.gov|)(?=[\]|}\n\s])", "publisher$2Central Intelligence Agency");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)cbs ?news(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3CBS News$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)CBS News", "publisher$2$3CBS News");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:CNN ?(?:\.com|News|Entertainment|Travel|Politics|Wire|Health|)|Cable News Network)(?:\|[^\]]+|)(\]\])", "publisher$2$3CNN$4"); //13,957
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(\w+\.|)CNN ?(?:\.com|Money|News|Entertainment|Travel|Politics|Wire|Health|)(?:\.com|)|Cable News Network)", "publisher$2CNN"); //34,937
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)CNN(\]\]|)''", "$1CNN$2"); //?
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|encyclopedia|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)(?:Encyclop(?:a|e|æ)dia (?:of |)|)Britannica(?:\.com| Online|)(?:\|[^\]]+|)(\]\])", "$1$2$3Encyclopædia Britannica$4"); //12,427
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|encyclopedia|first|journal|last|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)(?:Encyclop(?:a|e|æ)dia (?:of |)|)Britannica(?:\.com| Online|)", "$1$2Encyclopædia Britannica"); //12,436
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Encyclopædia Britannica", "work$2$3Encyclopædia Britannica"); //2,944
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)(\[\[)Fox ?News ?(?:\.com|Channel|Insider|Media|Network|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Fox News$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*\=\s*)Fox ?News ?(?:\.com|Channel|Insider|Media|Network|)", "publisher$2Fox News");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)global ?security(?:\.org|)(?:\|[^\]]+|)(\]\])", "publisher$2$3GlobalSecurity.org$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)global ?security(?:\.org|)", "publisher$2GlobalSecurity.org");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:International Monetary Fund|imf\.org)(?:\|[^\]]+|)(\]\])", "publisher$2$3International Monetary Fund$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:International Monetary Fund|imf\.org)", "publisher$2International Monetary Fund");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:articles\.|The |)(?:L\.? ?A\.?|Los Angeles) ?Times(?:\.com| Media Group| News Service|)(?:\|[^\]]+|)(\]\])", "$1$2$3Los Angeles Times$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:\w+\.|The |)(?:L\.? ?A\.?|Los Angeles) ?Times(?:\.com| Media Group| News Service|)", "$1$2Los Angeles Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Los Angeles Times", "work$2$3Los Angeles Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Merriam[ -–]Webster(?:\.com|,? Inc\.?(?:orporated|)| online|)(?:\|[^\]]+|)(\]\])", "publisher$2$3Merriam-Webster$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Merriam[ -–]Webster(?:\.com|,? Inc\.?(?:orporated|)| online|)", "publisher$2Merriam-Webster");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)NBC ?News(?:\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3NBC News$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)NBC ?News(?:\.com|)", "publisher$2NBC News");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:NPR(?:\.com|\.org| One| Now| News|)|National ?Public ? Radio(?: \(?(?:United States|NPR)\)?|))(?:\|[^\]]+|)(\]\])", "publisher$2$3NPR$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:NPR(?:\.com|\.org| One| Now| News|)|National ?Public ? Radio(?: \(?(?:United States|NPR)\)?|))", "publisher$2NPR");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)NPR(\]\]|)''", "$1NPR$2"); // 896
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:PBS(?:\.org| International| News| Online| Television|)|Public Broadcasting (?:Service(?: \(PBS\)|)|Station|System))(?:\|[^\]]+|)(\]\])", "publisher$2$3PBS$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:PBS(?:\.org| International| News| Online| Television|)|Public Broadcasting (?:Service(?: \(PBS\)|)|Station|System))", "publisher$2PBS");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)PR ?Newswire ?(?:\.com|\.co\.uk|Association LLC|Association|Europe|)(?:\|[^\]]+|)(\]\])", "agency$2$3PR Newswire$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)PR ?Newswire ?(?:\.com|\.co\.uk|Association LLC|Association|Europe|)", "agency$2PR Newswire");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)R[ue][ue]ters ?(?:Alertnet|UK|South Africa|International|Television|News (?:Agency|Service)|Foundation|Limited|\.com|India|Pictures|News|)(?:\|[^\]]+|)(\]\])", "agency$2$3Reuters$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)R[ue][ue]ters ?(?:Alertnet|UK|South Africa|International|Television|News (?:Agency|Service)|Foundation|Limited|\.com|India|Pictures|News|)", "agency$2Reuters");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)Reuters(\]\]|)''", "$1Reuters$2"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:San Francisco|S\.? ?F\.?) ?(?:Gate|Chronicle|)(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3San Francisco Chronicle$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:San Francisco|S\.? ?F\.?) ?(?:Gate|Chronicle)(?:\.com|)\b", "$1$2San Francisco Chronicle");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)San Francisco Chronicle", "work$2$3San Francisco Chronicle");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:\w+\.|)(?:(?:(?:N\.?|New) ?(?:Y\.?|York) ?(?:Times|T))(?:\.com|)|The New York Times)(?:\|[^\]]+|)(\]\])", "$1$2$3The New York Times$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\w+\.|)(?:(?:(?:N\.?|New) ?(?:Y\.?|York) ?(?:Times|T))(?:\.com|)|The New York Times)", "$1$2The New York Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)The New York Times", "work$2$3The New York Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)New York Times(\]\]|)''", "''$1The New York Times$2''");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |)Wall ?(?:Street|St\.?) ?Journals?|(?:The |online\.|)WSJ(?:\.com|))(?:\|[^\]]+|)(\]\])", "$1$2$3The Wall Street Journal$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:The |)Wall ?(?:Street|St\.?) ?Journals?|(?:The |\w+\.|)WSJ(?:\.com|))", "$1$2The Wall Street Journal");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Wall Street Journal", "work$2$3The Wall Street Journal");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Washington ?Post ?(?:\.com|Live|Online|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Washington Post$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Washington ?Post ?(?:\.com|Live|Online|)", "$1$2The Washington Post");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Washington Post", "work$2$3The Washington Post");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |)(?:U\.N\.|United Nation)s?(?: Organi[zs]ation|)|(?:\w+\.|(?:The |))\bUN\b(?:\.org|\.int|))(?:\|[^\]]+|)(\]\])", "publisher$2$3United Nations$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:The |)(?:U\.N\.|United Nation)s?(?: Organi[zs]ation|)|(?:\w+\.|(?:The |))\bUN\b(?:\.org|\.int|))", "publisher$2United Nations");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:United States|U\.? ?S\.?|) ?Navy(?:\.mil|\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3United States Navy$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:United States|U\.? ?S\.?|) ?Navy(?:\.mil|\.com|)", "publisher$2United States Navy");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:United States|U\.? ?S\.?|) ?Army(?:\.mil|\.com|)(?:\|[^\]]+|)(\]\])", "publisher$2$3United States Army$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:United States|U\.? ?S\.?|) ?Army(?:\.mil|\.com|)(?! \w+)", "publisher$2United States Army");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:United States|U\.? ?S\.?|) ?af(?:\.mil|\.com)(?:\|[^\]]+|)(\]\])", "publisher$2$3United States Air Force$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\b(?:United States|U\.? ?S\.?|) ?af(?:\.mil|\.com)", "publisher$2United States Air Force");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)USA ?Today(?:\.com| \(?newspaper\)?| Online|)(?:\|[^\]]+|)(\]\])", "$1$2$3USA Today$4"); //rs
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:\w+\.|)USA ?Today(?:\.com| \(?newspaper\)?| Online|)", "$1$2USA Today");; //rs
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)USA Today", "work$2$3USA Today");
//Western Europe
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)\b(?:AFP|Agence[- ]France[- ]Presse?)(?: \(?AFP\)?|\.com| \(?news(?: agency|)\)?|)\b(?:\|[^\]]+|)(\]\])", "agency$2$3Agence France-Presse$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)\b(?:AFP|Agence[- ]France[- ]Presse?)(?: \(?AFP\)?|\.com| \(?news(?: agency|)\)?|)\b", "agency$2Agence France-Presse");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:British Army|army\.mod\.uk)(?:\|[^\]]+|)(\]\])", "publisher$2$3British Army$4"); //62
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:British Army|army\.mod\.uk)", "publisher$2British Army"); //407
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:BBC|British Broadcasting Corp(?:oration|\.|))(?:\.com|\.co\.uk| \(BBC\)| UK|)(?:\|[^\]]+|)(\]\])", "publisher$2$3BBC$4"); //22,361
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:BBC|British Broadcasting Corp(?:oration|\.|))(?:\.com|\.co\.uk| \(BBC\)| UK|)", "publisher$2BBC"); //143,298
ArticleText=Regex.Replace(ArticleText, @"(?i)''(\[\[|)BBC(\.co.uk| Sports?| News|)(\]\]|)''", "$1BBC$3"); //5755
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)BBC(?:\.co\.uk\/sport| Sports?)(?: Online|)(?:\|[^\]]+|)(\]\])", "publisher$2$3BBC Sport$4"); //10515
ArticleText=Regex.Replace(ArticleText, @"(?i)\b(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)BBC(?:\.co\.uk\/sport| Sports?)(?: Online|)", "publisher$2BBC Sport"); //32754
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*publisher\s*=\s*(\[\[|)BBC Sport(\]\]|)\s*)\|\s*publisher\s*=\s*(\[\[|)(?:British Broadcasting Corporation|BBC)(\]\]|)", "$1"); //3,067
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:BBC(?: Evening| National|) (?:Magazine|News(?: Online|))|BBC\.com\/news|News\.BBC\.co\.uk)(?:\|[^\]]+|)(\]\])", "publisher$2$3BBC News$4"); //27124
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:BBC(?: Evening| National|) (?:Magazine|News(?: Online|))|BBC\.com\/news|News\.BBC\.co\.uk)", "publisher$2BBC News"); //78158
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*publisher\s*=\s*(\[\[|)BBC News(\]\]|)\s*)\|\s*publisher\s*=\s*(\[\[|)BBC(\]\]|)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|\s*publisher\s*=\s*(\[\[|)BBC(\]\]|)\s*(\|\s*publisher\s*=\s*(\[\[|)BBC News(\]\]|))", "$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:\b(?:Evening|London|Standard) ?(?:Evening Standard?|Standard(?: \(London\))?|\.co\.uk|\.com)|thisislondon(?:\.co\.uk|\.com|))(?:\|[^\]]+|)(\]\])", "$1$2$3Evening Standard$4|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:\b(?:Evening|London|Standard) ?(?:Evening Standard?|Standard(?: \(London\))?|\.co\.uk|\.com)|thisislondon(?:\.co\.uk|\.com|))", "$1$2Evening Standard|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Evening Standard", "work$2$3Evening Standard");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:Financial Times(?: \(London\)|))|(?:FT|Financial Times)(?:\.com|))\b(?:\|[^\]]+|)(\]\])", "$1$2$3Financial Times$4|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:Financial Times(?: \(London\)|))|(?:FT|Financial Times)(?:\.com|))\b", "$1$2Financial Times|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)?Financial Times", "work$2$3Financial Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)ITV News", "publisher$2ITV News");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Irish ?Independent|Independent Newspapers \(?Ireland\)?|Independent\.ie)(?:\|[^\]]+|)(\]\])", "$1$2$3Irish Independent$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Irish ?Independent|Independent Newspapers \(?Ireland\)?|Independent\.ie)", "$1$2Irish Independent");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)Irish Independent", "work$2$3Irish Independent");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:parliament\.uk|Parliament of the United Kingdom)(?:\|[^\]]+|)(\]\])", "publisher$2$3Parliament of the United Kingdom$4"); //668
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:parliament\.uk|Parliament of the United Kingdom)", "publisher$2Parliament of the United Kingdom"); //679
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |)(?:Daily |)Telegraph)(?:\.co\.uk|)(?:\|[^\]]+)(\]\])", "$1$2The Daily Telegraph|location=London"); // 20,784
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |)(?:Daily |)Telegraph)(?:\.co\.uk|)(\]\])", "$1$2$3The Daily Telegraph$4|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:telegraph\.co\.uk|(?:The |)Daily Telegraph)(?! \(Sydney\)|\|location=Sydney)", "$1$2The Daily Telegraph|location=London"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Daily Telegraph", "work$2$3The Daily Telegraph");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The ?|)Guardian(?:\.com|\.co\.uk| News(?:paper| and media|)| Unlimited| UK|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Guardian$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The ?|\w+\.|)Guardian(?:\.com|\.co\.uk| News(?:paper| and media|)| Unlimited| UK|)", "$1$2The Guardian"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Guardian", "work$2$3The Guardian");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Independent(?:\.co\.uk| \(?(?:london(?: \(UK\)|)|newspaper|UK(?: newspaper|)|Online)\)?|)(?:\|[^\]]+)(\]\])", "$1$2The Independent|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Independent(?:\.co\.uk| \(?(?:london(?: \(UK\)|)|newspaper|UK(?: newspaper|)|Online)\)?|)", "$1$2The Independent|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)Irish ?Times(?:\.com|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Irish Times$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)Irish ?Times(?:\.com|)", "$1$2The Irish Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Irish Times", "work$2$3The Irish Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |news\.|)Scotsman(?:\.com| \(?newspaper\)?|)(?:\|[^\]]+|)(\]\])", "$1$2$3The Scotsman$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |news\.|)Scotsman(?:\.com| \(?newspaper\)?|)", "$1$2The Scotsman");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*\=\s*)(\[\[|)The Scotsman", "work$2$3The Scotsman");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:the|)Timesonline\.co(?:\.uk|m)|(?:the ?|)Times ?on-?line)(?:\|[^\]]+|)(\]\])", "$1$2$3The Times$4|location=London"); // 210
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Thetimes\.co\.uk", "$1$2The Times|location=London");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Times", "work$2$3The Times");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|last|publisher|via)(\s*=\s*)(\[\[|)The Telegraph", "work$2$3The Telegraph");
// publisher → work
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*)publisher(\s*=\s*(?:\[\[|)(?:Blick|CounterPunch|Empire|Hamburger Morgenpost|Kerrang|Mixmag|Mojo|))(?:\.com|\.co\.uk|) ?(?=[\]|}\n])", "$1work$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*)publisher(\s*=\s*(?:\[\[|)(?:The ?|)(?:\w+ |)*(?:Christian Science Monitor|Economist|Gazette|Herald|Independent|Mail|Mirror|Post|Standard|Star|Telegraph|Times))(?:\.com|\.co\.uk|) ?(?=[\]|}\n])", "$1work$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s*)publisher(\s*=\s*(?:\[\[|)(?:The ?|)(?:Indian ?Express|Economic ?Times))(?:\.com|\.co\.uk|) ?(?=[\]|}\n])", "$1work$2");
// link maintenance
//Asia
ArticleText=Regex.Replace(ArticleText, @"(\[\[)(Sui|Liao|Song|Tang|Yuan) Dynasty\|([^\]]+)(\]\])", "$1$2 dynasty|$3$4"); //sc
ArticleText=Regex.Replace(ArticleText, @"(\[\[)(Sui|Liao|Song|Tang|Yuan) Dynasty(\]\])", "$1$2 dynasty$3"); //sc
//City State
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Atlanta(?:, Georgia|, GA|, USA?|, United States)\|([^\]]+)(\]\])", "$1Atlanta|$2$3"); //11,388
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Atlanta(, Georgia|, GA|, USA?|, United States)(\]\])", "$1Atlanta$3$2"); //11,388
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Baltimore, Maryland\|([^\]]+)(\]\])", "$1Baltimore|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Baltimore, Maryland(\]\])", "$1Baltimore$2, Maryland"); //(9,278)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Boston, Massachusetts\|([^\]]+)(\]\])", "$1Boston|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Boston, Massachusetts(\]\])", "$1Boston$2, Massachusetts"); //12087
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Chicago, (?:Illinois|United States)\|([^\]]+)(\]\])", "$1Chicago|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Chicago, (Illinois|United States)(\]\])", "$1Chicago$3, $2"); //14,330
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Cincinnati, Ohio\|([^\]]+)(\]\])", "$1Cincinnati|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Cincinnati, Ohio(\]\])", "$1Cincinnati$2, Ohio"); //(5,095)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Cleveland, Ohio\|([^\]]+)(\]\])", "$1Cleveland|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Cleveland, Ohio(\]\])", "$1Cleveland$2, Ohio"); //(7,585)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Denver, Colorado\|([^\]]+)(\]\])", "$1Denver|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Denver, Colorado(\]\])", "$1Denver$2, Colorado"); //(6,000)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Houston(?:, Texas|, TX|, USA?|, United States)\|([^\]]+)(\]\])", "$1Houston|$2$3"); //(9,361)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Houston(, Texas|, TX|, USA?|, United States)(\]\])", "$1Houston$3$2"); //(9,361)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Los Angeles, (?:California|CA|USA|United States)(\|[^\]]+)(\]\])", "$1Los Angeles|$2$3"); //3691
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Los Angeles, (California|CA|USA|United States)(\]\])", "$1Los Angeles$3, $2"); //16234
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Minneapolis, Minnesota(\]\])", "$1Minneapolis$2, Minnesota"); //(5,261)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)New Orleans, Louisiana(\]\])", "$1New Orleans$2, Louisiana"); //(6,700)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)New York City(, New York, (?:USA|United States)|, (?:United States|USA|NY|New York))(\]\])", "$1New York City$3$2"); //(3,917)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Sunderland, Tyne and Wear(\]\])", "$1Sunderland$2, Tyne and Wear"); //1,357
//Eastern Europe
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Russian Revolution of 1917\|([^\]]+)(\]\])", "$1Russian Revolution|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Russian Revolution of 1917(\]\])", "$1Russian Revolution$2 of 1917");
//Entertainment
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:The |)Official(?: UK | |)Charts?(?:\.com| Company|)\|([^\]]+)(\]\])", "$1Official Charts Company|$2$3"); //rs
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:The |)Official(?: UK | |)Charts?(?:\.com| Company|)(\]\])", "$1Official Charts Company$2"); //rs
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Syndicat National de l'[EÉ]dition Phonographique\|([^\]]+)(\]\])", "$1SNEP|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Syndicat National de l'[EÉ]dition Phonographique(\]\])", "$1SNEP$2");
//Military
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)War in Afghanistan \(2001[-–]present\)\|([^\]]+)(\]\])", "$1War in Afghanistan (2001–2021)|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Afghan(?:istan|) War|War in Afghanistan) ?\(\d{4}\s*[-–]?\s*(?:\d{2,4}|present|)\)(\]\])", "$1War in Afghanistan (2001–2021)$2"); //3,579
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Battery \(electricity\)\|([^\]]+)(\]\])", "$1Electric battery|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Captain \(land\)\|([^\]]+)(\]\])", "$1Captain (armed forces)|$2$3"); //1,210
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Maritime Commission(\]\])", "$1United States Maritime Commission$2"); //1,768
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Mentioned in Despatches(\]\])", "$1Mentioned in dispatches$2"); //1947
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Captain \(nautical\)\|([^\]]+)(\]\])", "$1Sea captain|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:WW|World War) ?(?:1|I|One)(\]\])", "$1World War I$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:WW|World War) ?(?:2|II|Two)(\]\])", "$1World War II$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)the (\[\[)First World War(\]\])", "$1World War I$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)the (\[\[)Second World War(\]\])", "$1World War II$2");
//Sports
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Football \(soccer\)\|([^\]]+)(\]\])", "$1Association football|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Australian Rules Football(\]\])", "$1Australian rules football$2"); //509
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Midfield(?:er|) \((?:(?:association |)football|soccer)\)\|([^\]]+)(\]\])", "$1Midfielder|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Midfielder)\|(\w+) \2(\]\])", "$3 $1midfielder$4"); //1828
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Autodromo Nazionale(?: di|) Monza\|([^\]]+)(\]\])", "$1Monza Circuit|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Autodromo(?: Internazionale|) Enzo e Dino Ferrari\|([^\]]+)(\]\])", "$1Imola Circuit|$2$3"); //1557
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:''|)(\[\[|)Rugby ?League ?Project(?:\.org|)(\]\]|)(?:''|)", "$1Rugby League Project$2");
//United States
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Associated Press News|The Associated Press)\|([^\]]+)(\]\])", "$1Associated Press|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)The Associated Press(\]\])", "the $1Associated Press$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Associated Press News(\]\])", "$1Associated Press$2 News");//567
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Amazon\.com(\|[^\]]+|)(\]\])", "$1Amazon (company)|Amazon$3"); //8.960
ArticleText=Regex.Replace(ArticleText, @"(?i)Amazon(?:\.com|\.co\.uk)", "Amazon");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Dropbox \(service\)\|([^\]]+)(\]\])", "$1Dropbox|$2$3"); //563
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)James River[, ] ?\(?Virginia\)?\|([^\]]+)(\]\])", "$1James River|$2$3"); //732
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)James River, Virginia(\]\])", "$1James River$2, Virginia"); //89
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Salvation Army\|([^\]]+)(\]\])", "$1The Salvation Army|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Salvation Army(\]\])", "$1The Salvation Army$2"); //1,911
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)United States of America\|([^\]]+)(\]\])", "$1United States|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)United States of America(\]\])", "$1United States$2 of America"); //12,443
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)United States\|United States of America(\]\])", "$1United States$2 of America"); //
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Army(\]\])", "$1United States Army$2"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Army Reserve(\]\])", "$1United States Army Reserve$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Marine Corps Reserve(\]\])", "$1United States Marine Corps Reserve$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Navy(\]\])", "$1United States Navy$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Air Force(\]\])", "$1United States Air Force$2"); //v
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Coast Guard(\]\])", "$1United States Coast Guard$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)U\.?S\.? Marines(\]\])", "$1United States Marines$2");
//Western Europe
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Académie française(\]\])", "$1Académie Française$2"); //1,563
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)British Broadcasting Corporation\|([^\]]+)(\]\])", "$1BBC|$2$3"); //905 873
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)British Railways\|([^\]]+)(\]\])", "$1British Rail|$2$3"); //1970
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:British|Honourable) East India Company\|([^\]]+)(\]\])", "$1East India Company|$2$3"); //398
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)East India Company\|British East India Company(\]\])", "British $1East India Company$2"); //291
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Civil parish(?:es (?:in|of) (?:Britain|England)| \(England\)|es|)\|([^\]]+)(\]\])", "$1Civil parish|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Civil parishes (in|of) England(\]\])", "$1Civil parish$3es $2 England");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Coronation of Queen Elizabeth II(\]\])", "$1Coronation of Elizabeth II$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Dissolution of the Monasteries\|([^\]]+)(\]\])", "$1Dissolution of the monasteries|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Dissolution of the Monasteries(\]\])", "$1dissolution of the monasteries$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Easter Sunday|Easter\|Easter Sunday)(\]\])", "$1Easter$2 Sunday");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Queen |)Elizabeth I(?: of England|)\|([^\]]+)(\]\])", "$1Elizabeth I|$2$3"); //3393
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Elizabeth I of England(\]\])", "$1Elizabeth I$2 of England"); //979
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Queen Elizabeth I of England(\]\])", "Queen $1Elizabeth I$2 of England"); //101
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Elizabeth I\|Queen Elizabeth I(\]\])", "Queen $1Elizabeth I$2"); //86
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Elizabeth II of the United Kingdom|Queen Elizabeth II)\|([^\]]+)(\]\])", "$1Elizabeth II|$2$3"); //1922 2,201
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Elizabeth II of the United Kingdom(\]\])", "$1Elizabeth II$2 of the United Kingdom"); //174
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)First French Republic(\]\])", "$1French First Republic$2"); //778
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Queen Elizabeth II(\]\])", "Queen $1Elizabeth II$2"); //3,140
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Elizabeth II\|Queen Elizabeth II(\]\])", "Queen $1Elizabeth II$2"); //1,919
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Queen Elizabeth II\|Elizabeth II(\]\])", "Queen $1Elizabeth II$2"); //23
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Elizabeth Bowes-Lyon|Queen Elizabeth,? the Queen Mother)\|([^\]]+)(\]\])", "$1Queen Elizabeth The Queen Mother|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King George I of Great Britain|George I of (?:Great Britain(?: and Ireland)|the United Kingdom))\|([^\]]+)(\]\])", "$1George I of Great Britain|$2$3"); //50
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King |)George III of(?: the United Kingdom| Great Britain)\|([^\]]+)(\]\])", "$1George III|$2$3"); //2269 2351
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King |)George III of( the United Kingdom| Great Britain)(\]\])", "$1George III$3 $2"); //314 362
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George III\|King George III(\]\])", "King $1George III$2"); //185
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George IV of the United Kingdom\|([^\]]+)(\]\])", "$1George IV|$2$3"); //1593
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George IV of the United Kingdom(\]\])", "$1George IV$2 of the United Kingdom"); //123
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George IV\|King George IV(\]\])", "King $1George IV$2"); //38
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:(?:King |)Edward VI(?: of England)|King Edward VI)\|([^\]]+)(\]\])", "$1Edward VI|$2$3"); //1048
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Edward VI\|King Edward VI(\]\])", "King $1Edward VI$2"); //7
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King Edward VII(?: of the United Kingdom|)|Edward VII of the United Kingdom)\|([^\]]+)(\]\])", "$1Edward VII|$2$3"); //1128
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Edward VII of the United Kingdom(\]\])", "$1Edward VII$2 of the United Kingdom"); //128
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Edward VII\|King Edward VII(\]\])", "King $1Edward VII$2"); //359
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King Edward VIII|Edward VIII of the United Kingdom|Edward, Duke of Windsor)\|([^\]]+)(\]\])", "$1Edward VIII|$2$3"); //413
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Edward VIII of the United Kingdom(\]\])", "$1Edward VIII$2 of the United Kingdom"); //39
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Edward VIII\|King Edward VIII(\]\])", "King $1Edward VIII$2"); //119
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King George V(?: of the United Kingdom|)|George V of the United Kingdom)\|([^\]]+)(\]\])", "$1George V|$2$3"); //2057
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(King |)George V of the United Kingdom(\]\])", "$1$2George V$3 the United Kingdom"); //135
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George V\|King George V(\]\])", "King $1George V$2"); //654
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:George VI of the United Kingdom|King George VI)\|([^\]]+)(\]\])", "$1George VI|$2$3"); //810
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)King George VI(\]\])", "King $1George VI$2"); //855
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George VI of the United Kingdom(\]\])", "$1George VI$2 of the United Kingdom"); //71
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)George VI\|King George VI(\]\])", "King $1George VI$2"); //552
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King |)Henry VIII(?: of England|)\|([^\]]+)(\]\])", "$1Henry VIII|$2$3"); // (3624)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)King Henry VIII(\]\])", "King $1Henry VIII$2"); // (284)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Henry VIII of England(\]\])", "$1Henry VIII$2 of England"); // (890)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Henry VIII\|(King |)Henry VIII( of England|)(\]\])", "$2$1Henry VIII$4$3"); // (125)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)James I of England\|([^\]]+)(\]\])", "$1James VI and I|$2$3"); //1,794
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Légion d'honneur|Legion of Honor)(\]\])", "$1Legion of Honour$2"); //2506
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King Louis XIII|Louis XIII of France)\|([^\]]+)(\]\])", "$1Louis XIII|$2$3"); //573
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King William IV|William IV of the United Kingdom)\|([^\]]+)(\]\])", "$1William IV|$2$3"); //1,174
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)William IV of the United Kingdom(\]\])", "$1William IV$2 of the United Kingdom"); //(107)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)William IV\|King William IV(\]\])", "King $1William IV$2"); //(31)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XIII of France(\]\])", "$1Louis XIII$2 of France"); //398
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King Louis XIV(?: of France|)|Louis XIV of France)\|([^\]]+)(\]\])", "$1Louis XIV|$2$3"); //1812
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XIV\|King Louis XIV(\]\])", "King $1Louis XIV$2"); //37
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XIV\|Louis XIV of France(\]\])", "$1Louis XIV$2 of France"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XIV of France(\]\])", "$1Louis XIV$2 of France"); //1158
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King Louis XV|Louis XV of France)\|([^\]]+)(\]\])", "$1Louis XV|$2$3"); //828
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XV\|King Louis XV(\]\])", "King $1Louis XV$2"); //10
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XV of France(\]\])", "$1Louis XV$2 of France"); //529
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:King |)Louis XVI(?: of France|)\|([^\]]+)(\]\])", "$1Louis XVI|$2$3"); //1320
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XVI\|King Louis XVI(\]\])", "King $1Louis XVI$2"); //10
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)King Louis XVI of France(\]\])", "King $1Louis XVI$2 of France"); //19
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Louis XVI of France(\]\])", "$1Louis XVI$2 of France"); //1155
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Emperor |)Napol[eé][oó]ne?(?: Bon[ae]parte| I(?: of France|, Emperor of the French|)|)\|([^\]]+)(\]\])", "$1Napoleon|$2$3"); //sc
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Napoleon\|Napol[eé][oó]ne?( Bonaparte)(\]\])", "$1Napoleon$2$3"); //607
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Napoleon( Bonaparte|I of France)(\]\])", "$1Napoleon$3$2"); //2233
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Queen Elizabeth I(?: of England|)|Elizabeth I of England)\|([^\]]+)(\]\])", "$1Elizabeth I|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Queen Elizabeth I(\]\])", "Queen $1Elizabeth I$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Queen |)Victoria(?:, Queen|) of the United Kingdom\|([^\]]+)(\]\])", "$1Queen Victoria|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Queen Victoria of the United Kingdom(\]\])", "$1Queen Victoria$2 of the United Kingdom");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(\d{4}) (Australian|New Zealand|South African|United Kingdom) Census\|([^\]]+)(\]\])", "$1 $2 $3 census|$2 census$5");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(\d{4}) (Australian|New Zealand|South African|United Kingdom) Census(\]\])", "$1$2 $3 census$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Australian|New Zealand|South African|United Kingdom) census,? (\d{4})\|([^\]]+)(\]\])", "$1 $3 $2 census|$3$5"); //5872
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Australian|New Zealand|South African|United Kingdom) census,? (\d{4})(\]\])", "$1$3 $2 census$4"); //565
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Australia|New Zealand|South Africa|United Kingdom) (\d{4}) census\|([^\]]+)(\]\])", "$1 $3 $2 census|$3$5");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Australia|New Zealand|South Africa|United Kingdom) (\d{4}) census(\]\])", "$1$3 $2 census$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)University College, London(\]\])", "$1University College London$2"); //953
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Master of Arts \(Oxbridge and Dublin\)\|([^\]]+)(\]\])", "$1Master of Arts (Oxford, Cambridge, and Dublin)|$2$3"); //1,465 1,448
ArticleText=Regex.Replace(ArticleText, @"(\[\[)Member of Parliament\|([^\]]+)(\]\])", "$1Member of parliament|$2$3"); //11,747
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Protestant Reformation\|([^\]]+)(\]\])", "$1Reformation|$2$3"); //
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Protestant Reformation(\]\])", "Protestant $1Reformation$2"); //4621
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Roman |)Catholic(?:ism|s|)(?: church| Christianity| religion|)\|([^\]]+)(\]\])", "$1Catholic Church|$2$3"); //6244 26042
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Roman Catholic Church(\]\])", "Roman $1Catholic Church$2"); //17,277
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Royal Charter(\]\])", "$1royal charter$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Old English language\|([^\]]+)(\]\])", "$1Old English|$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Old English language(\]\])", "$1Old English$2 language"); //1,353
ArticleText=Regex.Replace(ArticleText, @"(?i)the (''|)(\[\[)London Gazette(\]\])(''|)", "$1$2The London Gazette$3$4"); //1,397
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Kingdom of Spain\|([^\]]+)(\]\])", "$1Spain|$2$3"); //1,174
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)Kingdom of Spain(\]\])", "Kingdom of $1Spain$2"); //(107)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(?:Radio |Television |)Call(?: |-|)(?:letter|sign)s?(?: \(radio\)|)\|([^\]]+)(\]\])", "$1Call sign|$2$3"); //791
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Radio |Television |)Call(?: |-|)signs?(\]\])", "$2 $1call sign$3"); //
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[|)Plos ?(?:1|One)(\]\]|)", "$1$2$3PLOS One$4"); //11,437
// Self publishers
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Academia\.edu(?:\|[^\]]+|)(\]\])", "via$2$3Academia.edu$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Academia\.edu", "via$2Academia.edu");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:The |)British ?Newspaper ?Archive(?:\.co\.uk|)(?:\|[^\]]+|)(\]\])", "via$2$3British Newspaper Archive$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:The |)British ?Newspaper ?Archive(?:\.co\.uk|)", "via$2British Newspaper Archive");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)youtube(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3YouTube$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)youtube(?:\.com|)", "via$2YouTube");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)facebook(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Facebook$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)facebook(?:\.com|)", "via$2Facebook");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)find ?articles(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3FindArticles$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)find ?articles(?:\.com|)", "via$2FindArticles");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:Project |)Gutenberg(?: of|) Australia|gutenberg\.net\.au)(?:\|[^\]]+|)(\]\])", "via$2$3Project Gutenberg Australia$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:Project |)Gutenberg(?: of|) Australia|gutenberg\.net\.au)", "via$2Project Gutenberg Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:Project |)Gutenberg(?:\.org|)(?:\|[^\]]+|)(\]\])", "via$2$3Project Gutenberg$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:Project |)Gutenberg(?:\.org|)", "via$2Project Gutenberg");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)highbeam(?:\.com| research| business|)(?:\|[^\]]+|)(\]\])", "via$2$3HighBeam$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)highbeam(?:\.com| research| business|)", "via$2HighBeam Research");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)instagram(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Instagram$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)instagram(?:\.com|)", "via$2Instagram");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:(?:The |)Internet Archives?(?! Wayback Machine)|(?<!web\.)(?<!wayback\.)archive\.org)(?:\|[^\]]+|)(\]\])", "via$2$3Internet Archive$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:(?:The |)Internet Archives?(?! Wayback Machine)|(?<!web\.)(?<!wayback\.)archive\.org)", "via$2Internet Archive");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:National Library of Australia|Australian National LIbrary|(?:catalogue\.|)nla\.gov\.au)(?:\|[^\]]+|)(\]\])", "via$2$3National Library of Australia$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:National Library of Australia|Australian National LIbrary|(?:catalogue\.|)nla\.gov\.au)", "via$2National Library of Australia");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)(?:press ?reader|newspaper ?direct(?: Inc\.|))(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Press Reader$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(?:press ?reader|newspaper ?direct(?: Inc\.|))(?:\.com|)", "via$2Press Reader");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Scribd(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Scribd$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Scribd(?:\.com|)", "via$2Scribd");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)vimeo(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Vimeo$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)vimeo(?:\.com|)", "via$2Vimeo");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)twi?tte?r(?:\.com|Inc\.?|)(?:\|[^\]]+|)(\]\])", "via$2$3Twitter$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)twi?tte?r(?:\.com|Inc\.?|)", "via$2Twitter");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Newspapers\.com(?:\|[^\]]+|)(\]\])", "via$2$3Newspapers.com$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Newspapers\.com", "via$2Newspapers.com");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)(\[\[)Tumblr(?:\.com|)(?:\|[^\]]+|)(\]\])", "via$2$3Tumblr$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(agency|author|first|journal|last|magazine|newspaper|periodical|publisher|via|website|work)(\s*=\s*)Tumblr(?:\.com|)", "via$2Tumblr");
// RemoveTemplateParameter
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox football club season", "conference result"); //845
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox football club season", "ceo"); //845
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox football club season", "conference"); //845
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox football club season", "ceotitle"); //845
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox military person", "residence"); //439
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox military person", "nationality"); //439
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "infobox sportsperson", "residence"); //2838
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "Infobox rugby league biography", "nickname"); //308
ArticleText = WikiFunctions.Tools.RemoveTemplateParameter(ArticleText, "Infobox musical artist", "associated_acts"); //39,637
// Minor formatting
ArticleText=Regex.Replace(ArticleText, @"(?i)League A\s?(?:‑+|-+|-|−|–|—|–|—)\s?Z Player", "League A–Z Player");
// rem corporate designation
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?publisher\s*\=\s*[^\[\|\}]{1,40}), (?:Inc|LL[CP]|Ltd|PLC|SA)\.?(?=[ ]*\|\})", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?publisher\s*\=\s*[^\[\|\}]{1,40}) (?:Inc|LL[CP]|Ltd|PLC|SA)\.?(?=[ ]*\|\})", "$1");
// rem unnecessary quote marks
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?title\s*\=\s*)['‘]([^\|'’]+)['’](?=\s?[\|\}])", "$1$2");
// rem misplaced punctuation
ArticleText=Regex.Replace(ArticleText, @"(?i)(<ref[^>]*>[^<]+?[\]\.\},;–]\s*\'\'[\w-]*(?: [\w-]*){0,3})(\.com|)([;,\.])(\'\')([^<]*?<\/ref>)", "$1$2$4$3$5");
// ArticleText=Regex.Replace(ArticleText, @"(?i)([\w]+)\.(['"""]\]?)(\W)", "$1$2.$3"); //LQ for titles
// removing blank parameters
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\|[ ]*(?:access-?date|agency|archive-?(?:date|url)|arxiv|asin|at|author(-?link|-mask|-name-separator|-separator|\d|\d-link|link\d?|)|bibcode|chapter|chapter(?:url|-url)|coauthors|contribution(?:-url|)|date|deadurl|df|display-authors|doi|doi-inactive|doibroken|edition|editor(?:-first|-last|-link|\d|\d-first|\d-last|\d-link|)|(?:first|last)\d?|format|id|is[bs]n|issue|jfm|journal|jstor|language|lay(?:date|source|summary)|lccn|location|magazine|month|mr|newspaper|nopp|oclc|ol|origyear|osti|others|pages?|periodical|place|pm[cd]|pmid|postscript|publication(?:-date|-place)|publisher|quote|ref|rfc|separator|series|ssrn|trans_title|type|url|via|volume|website|work|year|zbl)[ ]*=[\s]*)(?=[\}\|])", "");
//rem redundant top-level domains (.com, .net, .org)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|\s?(?:journal|newspaper|periodical|publisher|work)\s*\=\s*)(\[\[[^\[\]\}]*\]\])\.(?:biz|com|net|org|co\.uk)(?=\s*[\|\}])", "$1$2");
//rem duplicated publishers in separate fields (pre)
ArticleText=Regex.Replace(ArticleText, @"(?i)[‒–—―]+\s*([^\|\}]{3,})\s*(\|\s?(?:publisher|work)\s*\=\s*(?:\w+\.|))\1(?=\s[\|\}])", "$2$1");
//'work' and its alias (pre)
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*?newspaper[ ]*=[^\|]*(?:\|[^\{\}]*|))(?:\|[ ]*?work[ ]*=[^\|\}]*)(?=[\|\}])+", "$1");
// removing english language parameter
ArticleText=Regex.Replace(ArticleText, @"(?i)\s*\|language\s*=\s*en(?:-\w{2}|glish|)\s*", "");
// eliminating time of day
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*author[ ]*=[ ]*)(?:posted|published)(?: by| on|)[\s:](?=\s*\w)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*author[ ]*=[ ]*)[123]?\d (Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?) (?:(?:18|19|20|\d)\d{2})(?: at| on)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*author[ ]*=[ ]*)[123]?\d (Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?) (?:(?:18|19|20|\d)\d{2})", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)[0-2]?\d:[0-5]\d(?:[ ]| )(?:[ap]m ?|[ap]\.m\. |[A-Z]{1,2}T|UTC)[\.,]?[ ]?", "$1");
// eliminating days of the week
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,?)\s", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:Mon|Tues?|Wed|Thur?|Fri|Sat|Sun)[\.,]?)\s", "$1");
return ht.AddBack(ArticleText);
return ArticleText;
}