//
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);
//launch year template etc
ArticleText=Regex.Replace(ArticleText, @"{{(?:avyear|ly|scy|sdy)\|(\d{1,4})}}", "$1");
// ArticleText=Regex.Replace(ArticleText, @"{{(?:avyear|by|ly|scy|sdy)\|(\d{1,4})}}", "$1");
//fix redirect to processor name
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(4004|4040|8008|8048|8051|8080|8085|8086|8088)\]\]", "[[Intel $1|$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(6309)\]\]", "[[Hitachi $1|$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(6501|6502)\]\]", "[[MOS Technology $1|$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(6800|6809)\]\]", "[[Motorola $1|$1]]");
//year: change to protect band '4AD'. Undone below
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[4AD\]\]", "[[:4AD]]");
// century
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?: |-)first)(?: |-))(century|centuries)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?: |-)first)(?: |-))(century|centuries) (AD|BC|CE|BCE)\]\]", "$1$2 $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,2}(?:st|nd|rd|th)(?: |-))century\]\]", "$1century");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,2}(?:st|nd|rd|th)(?: |-))centuries\]\]", "$1centuries");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}(?:st|nd|rd|th)(?: |-)century\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,2}(?:st|nd|rd|th)(?: |-))century (AD|BC|CE|BCE)\]\]", "$1century $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2}(?:st|nd|rd|th)(?: |-)century\|([^\]]{1,30})\]\]", "$1");
// decades and years
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,4})\'?s\]\]", "$1s");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,4})\'?(s)? ?(AD|BC|CE|BCE)\]\]", "$1$2 $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4}\'?s? ?(?:AD|BC|CE|BCE)\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4}\'?s?\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d\d?(?:st|nd|rd|th) centur(?:y|ies)\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\w{5,12} centur(?:y|ies)\|([^\]]{1,30})\]\]", "$1");
// solitary day_numbers
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,2}(?:st|nd|rd|th))\]\]", "$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, @"(?:the\s?)?([1-3]?\d)(?:th|st|nd|rd|), ([1-3]?\d)(?: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\d])", "$1, $2$3 $4 $5");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?)?([1-3]?\d)(?: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\d])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"(?:the\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\d])", "$1 $2$3");
ArticleText=Regex.Replace(ArticleText, @"(?:the\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\d])", "$1 $2$3");
ArticleText=Regex.Replace(ArticleText, @"(?:the\s?)?([1-3]?\d)<sup>(?:th|st|nd|rd|)<\/sup>(?:\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$3");
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|),\s(?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)([^\]\|\w\d][^\d])", "$1 $2, $3$4 $5$6");
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|)(\s(?:and|&|to|or)\s)(?:the\s)?([1-3]?\d)(?: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-3]?\d)(?:th|st|nd|rd)([^\]\|\w\d][^\d])", "$1 $2$3");
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)<sup>(?:th|st|nd|rd)<\/sup>([^\]\|\w\d][^\d])", "$1 $2$3");
//Month + year
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{3,4} (?:January|February|March|April|May|June|July|August|September|October|November|December))\]\]", "$1");
//delink autoformattable dates
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s([0-3][\d]|[\d])(?:st|nd|rd|th|)\]\](?:st|nd|rd|th|),?\s*\[\[(\d{1,4})\]\]", "$1 $2, $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([0-3][\d]|[\d])(?:st|nd|rd|th|)\s(January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s*\[\[(\d{1,4})\]\]", "$1 $2 $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s([0-3][\d]|[\d])(?:st|nd|rd|th|)\]\](?:st|nd|rd|th|)", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([0-3][\d]|[\d])(?:st|nd|rd|th|)\s(January|February|March|April|May|June|July|August|September|October|November|December)\]\]", "$1 $2");
//remove piped years
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,4} in [^\|]+\|(\d{1,4})\]\]", "[[$1]]");
//'present'
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Present \(time\)\|(Present)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Present)\]\]", "$1");
//Season
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(spring \(season\)|summer|winter|autumn)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[spring \(season\)\|(spring)\]\]", "$1");
//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");
//'As of year'
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[As\sof\s(\d{1,4})\]\]", "{{As of|$1}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[As\sof\s(\d{1,4})\|\d{1,4}\]\]", "{{As of|$1|alt=$1}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[as\sof\s(\d{1,4})\]\]", "{{As of|$1|lc=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[as\sof\s(\d{1,4})\|\d{1,4}\]\]", "{{As of|$1|alt=$1}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[[Aa]s\sof\s(\d{1,4})\|currently\]\]", "{{As of|$1|alt=currently}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[[Aa]s\sof\s(\d{1,4})\|still\]\]", "{{As of|$1|alt=still}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[[Aa]s\sof\s(\d{1,4})\|Still\]\]", "{{As of|$1|alt=Still}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[[Aa]s\sof\s(\d{1,4})\|modern\]\]", "{{As of|$1|alt=modern}}");
ArticleText=Regex.Replace(ArticleText, @"As\sof\s\[\[As\sof\s(\d{1,4})\]\]", "{{As of|$1}}");
ArticleText=Regex.Replace(ArticleText, @"as\sof\s\[\[As\sof\s(\d{1,4})\]\]", "{{As of|$1|lc=on}}");
// months
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(January|February|March|April|May|June|July|August|September|October|November|December)\]\]", "$1");
//Treat 'Sept' (i.e. month abbreviation) differently from 'sept' (i.e. family)
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[January\|(Jan)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[February\|(Feb)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[March\|(Mar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[April\|(Apr)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[May\|(May)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[June\|(Jun)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[July\|(Jul)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[August\|(Aug)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[September\|(Sep)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[October\|(Oct)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[November\|(Nov)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[December\|(Dec)\]\]", "$1");
//month piped to number
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,4})\]\]", "$1");
//month piped to number
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,4})\]\]", "$1");
//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) \d?\d)\]\]( ?\-? ?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$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) \d?\d)\]\]( ?&[nm]dash; ?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\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) \d?\d)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\]( ?\-? ?)\[\[(\d{1,2})\]\]", "$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) \d?\d)\]\]( ?&[nm]dash; ?)\[\[(\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) \d?\d)\]\](\/)\[\[(\d{1,2})\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\]( ?\-? ?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$1$2$3$4");
//same again but with ndash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\]( ?&[nm]dash; ?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$1$2$3$4");
//same again but with slash instead of hyphen
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$1$2$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2})\]\]", "$1");
//month+day piped into month+day or vice versa
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2} (?: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})\]\]", "$1");
//year: now remove unprotected linked years
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([12]?\d{1,3})\]\]", "$1");
//remove flagicons from birth and death
ArticleText=Regex.Replace(ArticleText, @"(?i)((?:birth|birth_?place|death|death_?place|burial) ?= ?)\{\{flagicon\|[^\}]+\}\}", "$1");
//delink common units
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|[\d\.]*\|(?:mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|g|kg|mL|L|in|in2|in3|ft|sqft|ft2|cuft|ft3|yd|sqyd|yd2|cuyd|yd3|mi|sqmi|mi2|cumi|mi3|acre|nmi|lb|USgal)\|[^\}]*)\|lk=(?:on|in|out)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|[^\}]*)\|lk=off", "$1");
//aviation specifications: protect "main=" and "alt=" - undone below
ArticleText=Regex.Replace(ArticleText, @"(?i)((?:main|alt) ?= ?)(\d)", "$1xx$2");
//convert excessive zeros for oil
ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|\d+)000000000000\|oilbbl\|", "$1|Toilbbl|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|\d+)000000000\|oilbbl\|", "$1|Goilbbl|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|\d+)000000\|oilbbl\|", "$1|Moilbbl|");
//embed 'per day' into pre-existing conversions
ArticleText=Regex.Replace(ArticleText, @"(?i)(oilbbl)\|(k?m3)(}})(?: |-| |)(?:per|a)(?: |-| |)day", "$1/d|$2/d$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(oilbbl)\|(k?m3)(\|abbr=on}})(?: |-| |)(?:per|a)(?: |-| |)day", "$1/d|$2/d$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(oilbbl)\|(k?m3)(\|sing=on}})(?: |-| |)(?:per|a)(?: |-| |)day", "$1/d|$2/d$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(oilbbl)\|(k?m3)(}})/d", "$1/d|$2/d");
//foot - remove period when followed by parentheses
ArticleText=Regex.Replace(ArticleText, @"(\d ft)\.( \(\d)", "$1$2");
// knot
ArticleText=Regex.Replace(ArticleText, @"(?i)\[knot \(unit\)\|", "[knot (speed)|");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[kts\]\]", "[[knot (speed)|knots]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|kts\]\]", "|knots]]");
//convert knot template to kn to match km
ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|[\d\.]+)\|knot\|", "$1|kn|");
//nautical mile - rename "miles" as "nautical miles" when followed by knots or conversion code
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?: |-| |)miles (?:at|@) ([\d\.]{1,9}(?: |-| |)knots|{{convert)", "$1 nautical miles at $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)( |-| )(?:mi|nm|nmi) (?:at|@) ([\d\.]{1,9}(?: |-| |)knots|{{convert)", "$1$2nmi at $3");
//remove commas from numerical values in convert template
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+),(\d)", "$1$2");
//aviation specifications: unprotect "main=" and "alt="
ArticleText=Regex.Replace(ArticleText, @"(?i)((?:main|alt) ?= ?)xx(\d)", "$1$2");
//replace other templates with convert template
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi to km\|(\d{1,9})}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi to km\|(\d{1,9})\|round[^\}]{1,5}}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi2 to km2\|(\d{1,9})}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi2 to km2\|(\d{1,9})\|round[^\}]{1,5}}}", "{{convert|$1|mi|km}}");
//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\|)0(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|)0(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|)0(\d)", "$1$2");
//Remove surprise or "Easter egg" diversions linking unit name to orders of magnitude articles
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[1 ?_?E ?[\-\+]?\d{1,2} ?..?\|([^\]]{1,50})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Orders of magnitude \([^\)]+\)\|([^\]]{1,50})\]\]", "$1");
//convert squares and cubes
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqmm\|", "$1|mm2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqcm\|", "$1|cm2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqm\|", "$1|m2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqkm\|", "$1|km2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqmm}", "$1|mm2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqcm}", "$1|cm2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqm}", "$1|m2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqkm}", "$1|km2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cumm\|", "$1|mm3|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cucm\|", "$1|cm3|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cum\|", "$1|m3|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cukm\|", "$1|km3|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cumm}", "$1|mm3}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cucm}", "$1|cm3}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cum}", "$1|m3}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|cukm}", "$1|km3}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqmi sqkm}", "$1|sqmi km2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|sqmi sqkm\|", "$1|sqmi km2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|(in|ft|yd|mi)2\|", "$1|sq$2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|(in|ft|yd|mi)2}", "$1|sq$2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|(in|ft|yd|mi)3\|", "$1|cu$2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|(in|ft|yd|mi)3}", "$1|cu$2}");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|mi2 (?:sqkm|km2)\|", "$1|sqmi km2|");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|[^}]+)\|mi2 (?:sqkm|km2)}", "$1|sqmi km2}");
//delink common units of measurement in convert template
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)\|lk=on", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)(\|\d)\|lk=on", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)\|(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)\|lk=on", "$1$2|$3");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)\|(mm|mm2|mm3|cm|cm2|cm3|m|m2|m3|km|km2|km3|in|ft|sqft|mi|sqmi)(\|\d)\|lk=on", "$1$2|$3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\]\], )\[\[(Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Argentina|Armenia|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of the Congo|Costa Rica|Côte d'Ivoire|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia \(country\)|Germany|Ghana|Greece|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|(?:North |South |)Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|Mexico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:Kingdom of the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|SADR|Saint Kitts and Nevis|Saint Lucia|Saint Vincent and the Grenadines|Samoa|San Marino|São Tomé and Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|England|Scotland|Wales|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)\]\]", "$1$2");
// Country subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\]\]", "$1$2"); // Canadian subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Ain|Aisne|Allier|Alpes-de-Haute-Provence|Hautes-Alpes|Alpes-Maritimes|Ardèche|Ariège|Aube|Aude|Aveyron|Bouches-du-Rhône|Calvados|Cantal|Charente|Charente-Maritime|Corrèze|Corse-du-Sud|Haute-Corse|Côte-d'Or|Côtes-d'Armor|Creuse|Dordogne|Doubs|Drôme|Eure|Eure-et-Loir|Finistère|Gard|Haute-Garonne|Gers|Gironde|Hérault|Ille-et-Vilaine|Indre|Indre-et-Loire|Isère|Loir-et-Cher|Loire|Haute-Loire|Loire-Atlantique|Loiret|Lot-et-Garonne|Lozère|Maine-et-Loire|Manche|Marne|Haute-Marne|Mayenne|Meurthe-et-Moselle|Meuse|Morbihan|Moselle|Nièvre|Oise|Orne|Pas-de-Calais|Puy-de-Dôme|Pyrénées-Atlantiques|Hautes-Pyrénées|Pyrénées-Orientales|Bas-Rhin|Haut-Rhin|Haute-Saône|Saône-et-Loire|Sarthe|Savoie|Haute-Savoie|Paris|Seine-Maritime|Seine-et-Marne|Yvelines|Deux-Sèvres|Somme|Tarn-et-Garonne|Vaucluse|Vendée|Vienne|Haute-Vienne|Vosges|Yonne|Territoire de Belfort|Essonne|Hauts-de-Seine|Seine-Saint-Denis|Val-de-Marne|Val-d'Oise|Guadeloupe|Martinique|French Guiana|Réunion)\]\]", "$1$2"); // French subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(?:Ardennes|Cher|Jura|Landes|Lot|Nord|Rhône|Tarn|Var) \((?:French |)department\)\|(Ardennes|Cher|Jura|Landes|Lot|Nord|Rhône|Tarn|Var)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Andalusia|Aragon|Asturias|Balearic Islands|Canary Islands|Cantabria|Castile and León|Castile-La Mancha|Catalonia|Extremadura|Navarre|Valencian Community|Islas Chafarinas|Peñón de Alhucemas|Peñón de Vélez de la Gomera)\]\]", "$1$2"); // Spanish
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(?:Basque Country \(autonomous community\)|Community of Madrid|Region of Murcia)\|(Basque Country|Madrid|Murcia)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(?:Galicia|La Rioja) \(Spain\)\|(Galicia|La Rioja)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Baden-Württemberg|Bavaria|Berlin|Brandenburg|Hamburg|Hesse|Ländereinführungsgesetz|Lower Saxony|Mecklenburg-Vorpommern|North Rhine-Westphalia|Rhineland-Palatinate|Saarland|Saxony|Saxony-Anhalt|Schleswig-Holstein|South Baden|Thuringia|Württemberg-Baden|Württemberg-Hohenzollern)\]\]", "$1$2"); // German subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Lombardy|Campania|Lazio|Sicily|Veneto|Piedmont|Emilia-Romagna|Apulia|Tuscany|Calabria|Sardinia|Liguria|Marche|Abruzzo|Friuli-Venezia Giulia|Trentino-Alto Adige\/Südtirol|Umbria|Basilicata|Molise|Aosta Valley)\]\]", "$1$2"); // Italian subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[(Bedfordshire|Berkshire|Bristol|Buckinghamshire|Cambridgeshire|Cheshire|Cornwall|Cumbria|Derbyshire|Devon|Dorset|County Durham|East Riding of Yorkshire|East Sussex|Essex|Gloucestershire|Greater London|Greater Manchester|Hampshire|Herefordshire|Hertfordshire|Isle of Wight|Kent|Lancashire|Leicestershire|Lincolnshire|City of London|Merseyside|Norfolk|Northamptonshire|Northumberland|North Yorkshire|Nottinghamshire|Oxfordshire|Rutland|Shropshire|Somerset|South Yorkshire|Staffordshire|Suffolk|Surrey|Tyne and Wear|Warwickshire|West Midlands|West Sussex|West Yorkshire|Wiltshire|Worcestershire)\]\]", "$1$2"); // English subdivisions
ArticleText=Regex.Replace(ArticleText, @"(\]\], )\[\[West Midlands \(county\)\|(West Midlands)\]\]", "$1$2");
// US States piped
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[[^\]]{1,20}\,\s(?:AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming))\|(?:[^\]]{1,20})\]\]\,?\s\[\[(?:Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|West Virginia|Wisconsin|Wyoming)(?:\|(?:AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY)|)\]\]", "$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:[^\]]{1,20})\,\s(?:Georgia|Washington))\|(?:[^\]]{1,20})\]\]\,?\s\[\[(?:Georgia|Washington) \((?:U. ?S.? |)state\)\|(Georgia|Washington)\]\]", "$1]]");
//Canada
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([^\]]{1,20})\,\s(AB|Alta\.?|B\.?C\.?|Man\.?|MB|N\.?B\.?|N\.?S\.?|Nfld\.?, Lab\.?|NL|ON|Ont\.?|P\.?E\.?I\.?|PE|QC|Que\.?, P\.?Q\.?|Sask\.?|SK|Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\|([^\]]{1,20})\]\]\,?\s\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\]\]", "[[$1, $2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Beijing|Berlin|Paris|Hong\sKong|London|Melbourne|Mexico\sCity|Moscow|New\sDelhi|Rome|Shanghai|Sydney|Tokyo)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Chicago|Detroit|Los\sAngeles|Miami|New\sYork\sCity|San\sFrancisco|Washington\,?\sD\.?C\.?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(California|Florida|Hawai.?i|New\sYork|Texas)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Paris, France)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(London, England)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Sydney, New South Wales)\]\]", "Sydney");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:Los Angeles|San\sDiego|San\sFrancisco), (?:California|CA))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:Los Angeles|San\sDiego|San\sFrancisco)(?:,\sCalifornia|,\sCA|))\|([^\]]{1,30})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:New York City)\|([^\]]{3,30})\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[Vancouver)\]\], \[\[(British Columbia\]\])", "$1, $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Sydney(?:,\sNew South Wales|,\sAustralia)\|([^\]]{1,30})\]\]", "$1");
//continents and regions
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Arctic\sOcean|Atlantic\sOcean|Indian\sOcean|Pacific|Pacific\sOcean)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:Asia|Africa|Americas?|Antartica|Europe|Australia|Oceania|Asia-Pacific|(?:Middle|Far) East)(?:a?n|ern|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:north-?(?:west|east|)|south-?(?:west|east|)|east|west|central)(?:ern | )(?:Asia|Africa|America|Atlantic|Europe|Australia|Oceania|Pacific|United States|Canada|China|Russia))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Latin America)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Asia|Africa|America|Arabia|Europe|Australia|Oceania|Asia-Pacific|(?:Middle|Far) East)\|([^\]]*)\]\]", "$1");
// Country and language; city
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(area|border|cit(?:y center|y centre|ies|y)|countr(?:y|ies)|count(?:y|ies)|district|parish|province|region|rural|suburb|town(?:ship|)|(?:sub|)urban(?: area|)|village)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:rural|(?:sub)?urban)(?: area|i[sz]ation|)\||)((?:rural|(?:sub|)urban)(i[sz]ed?|i[sz]ation| area|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:urban agglomeration\||)(agglomeration)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:List of (?:countries|U.S. states|sovereign states)|Countries of the world)\|(country|countries|states?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:US|U\.S\.) state(?:s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:US|U\.S\.) states?\|(states?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[States and territories of \w*\|(states?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[city\|(cities)\]\]", "$1");
//Linking template - outright removal of {{lang-en}}
ArticleText=Regex.Replace(ArticleText, @"(?i)\{\{lang(?:-|\|)en\|([^\}\|]*?)\}\}", "\'\'$1\'\'");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\{\{lang-(?:de|es|fr|ru|zh)\|)([^\}\|]*?\}\})", "$1link=no|$2");
//top 7
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:American|Australian|British|Canadian|Chinese|Japanese|English|French|Irish|Italian|Spanish|Russian|German)\s\(?(?:language|literature|people)\)?\|(American|Australian|British|Canadian|Chinese|Japanese|English|French|Irish|Italian|Spanish|Russian|German)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Americans\||)(American)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Australians\||)(Australian)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Canadians\||)(Canadian)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Germans\||)(German)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:People's Republic of |)China|Canad(?:a|ians?)|Chinese|England|English|France|French|Germany?|Great\sBritain|British|Ireland|Irish|Ital(?:y|ians?)|Japan(?:ese|)|Russian?|Spain|Spanish)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:People's Republic of |)China|Canada|England|France|Germany|Great\sBritain|Ireland|Italy|New Zealand|Japan|Spain|United\sKingdom|U\.K\.|UK|United\sStates(?:\sof\sAmerica|)|US|U\.S\.|USA|U\.S\.A\.)\|(Chinese|Canadian|English|French|German|British|Irish|Italian|New Zealander|Japanese|Spanish|American|US)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:British nationality law\||)(British|English|Scottish|Welsh|Northern Irish|UK)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:United\sStates(?:\sof\sAmerica|)\||)(?:USA?|U\.S\.(?:A\.|))\]\]", "US");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:United\sStates(?:\sof\sAmerica|)\||)(United\sStates(?:\sof\sAmerica|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|)\||)(U\.K\.|UK)\]\]", "UK");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|)\||)(Britain|British|United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:Chinese|English|French|German|Japanese|Spanish|American)\slanguage)\]\]", "$1"); //unpiped
//time and seasons
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(age|epoch|era|times)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Present\s\(time\)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(annual|da[iy]|month|(?:fort|)night|season(?:al|)|hour|minute|present|second|week|year|decade|century)([ -]?end|ly|s|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)days?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day)\|(Mon|Tues?|Wed|Thurs?|Fri|Sat|Sun|M|Tu|W|Th|F|Sa|Su)(\.|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(morning|afternoon|midnight|noon|sunrise|sunset|dawn|dusk|twilight)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(spring|summer|winter|autumn|fall)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[spring\s\(season\)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[autumn\|(fall)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:hour|minute|second)s?\||)(hr|min|sec|m|s)\]\]", "$1");
// months
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|\.))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|([^\]]{1,30})\]\]", "$1");
// simple words and numbers
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(\d{1,3}(,\d{3})*)\]\]", "$1");
// expressions in foreign languages
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(ad (?:hoc|hominem|nauseum)|de facto|et al\.?|fait accompli|faux pas|prima facie|status quo)\]\]", "$1");
// people general, professions
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(apprentice|arranger|art(?:ist|)|athlete|athletics|author|ballet|butcher|camera|career|comedian|composer|consul(?:ate|ar|tant|)|civilian|crew|(?:film |music |)critic|cultur(?:e|al)|dentist|design(?:er|)|dj|(?:dis[ck] |)jockey|drawing|educator|[eé]lite|embassy|engineer(?:ing|)|exhibition|explorer|fishing|group|guest star|hacker|leader|librar(?:ie|y)|lyricist|mayor|mathematic(?:al|ian|s)|music(?:al(?: theatre|theater|)|ian|)|multi-instrumentalist|narrator|panorama|playwright|postage(?: stamp|)|postman|produc(?:e[dr]|tion)|pseudonym|political commentator|pundit|(?:record )company|sailor|sculpt(?:or|ure)|soldier|solicitor|singer.songwriter|song|songwriter|songwriting|toy|tradition|trainee|trumpet(?:er|)|waiter)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:edit(?:or|ing)|journalism)\||)(columnists?|edit(?:ed|ing|ors?)|editors?-in-chief|editorial|reporter|journalis[mt]s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:auto|)biography\||)((?:auto|)biograph(?:er|y|ical|ies))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:philosophy\||)(philosoph(?:er|y|ical|ies))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:science\||)(scien(?:ce|tific(?:ally)|tists?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:screenwrit(?:er|ing)\||)((?:screen[ -]?|)writ(?:ers?|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:publi(?:cation|shing)\||)(publi(?:cation|shing|shers?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:photograph(?:er|y|)\||)(photograph(?:ers?|y|ic|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:conducting\||)(conduct(?:ed|ing|ors?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:piano|pianist)\||)(pianos?|pianists?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:prostitution\||)(prostitut(?:es?|ion))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:politic(?:s|ian)\||)(politic(?:s|al|ians?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:professional sports\||)(professional|professional sports?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:amateur sports\||)(amateur|amateur sports?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:movie theater\||)(movie theat(?:re|er)s?|cinemas?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:retirement\||)(retir(?:e[drs]?|ement|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"\[\[(?:[Cc]ivil\s[Ss]ervice\||)(?:[Cc]ivil\s[Ss]erv(ants?|ice))\]\]", "civil serv$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(cable |satellite |terrestrial |)(tv|television)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(clothing|cloth(?:es|)|cotton|denim|earring|fabric|footwear|garment|glove|hand ?bag|hat|jean|leather|legging|lingerie|silk|necklace|nylon|dress|tailor|(?:neck|)tie|shirt|sock|stocking|jacket|jewel(?:le|)ry|trouser|vest|watch|scarf|shoe|short|sunglasses|suit|wig)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(balm|eye.?liner|lip.?stick|mascara|perfume)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:cosmetics\||)(make.?up|cosmetics)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:coats?|belts?)\(clothing\)\||)(coats?|belts?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:ring \(jewel(?:le|)ry\)\||)((?:diamond |engagement |gold |pinkie |wedding |)rings?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(captain|major|general|lieutenant|private)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:captain|colonel|major|general(?: officer|)|lieutenant|sergeant|private)(?: \([\w]*\)|)\||)(captain|colonel|major|general|lieutenant|sergeant|private)\]\](?= \[)", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[musical theatre\|(music(?:al(?: theatre|theater|)s?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beauty (?:competition|contest|pageant|queen))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(answer|question|contest|contestant|game|pageant)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:competition\||)(competit(?:ions?|ive|ors?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:dance|choreography)\||)(choreograph(?:e[dr]s?|y|)|dance[drs]?|dancing)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:(?:paint|writ)ing|illustration)\||)(paint|writ|illustrat)(ed|[eo]rs?|ing)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bicycle|bike|boat|ferry|engine|motor(?:cycle|ing|)|ship|truck|tyre|van|vehicle|wheel)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(van)\]\]", "$1"); //false positive for 'Vans' clothing brand
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foo bar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(equipment|instrument|machine|tool)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\W\s+)\[\[(?:Ship naming and launching\|)(launched)\]\]", "$1$2");
//business & legal
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:chair \(official\)|chairman)\||)(chair(?:man|woman|person|))\]\]", "chairman");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(chair(?:m[ae]n|person)|contracts?|director|entrepreneur|intellectual property|judge|patent|(?:vice[- ]|)president|real estate|regulation|taxe?|taxation|trademark|treasurer)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(legisla(?:tion|tive assembl[iy]e?|tive council|ture))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:accountancy\||)(account(?:ant|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:business\||)((?:business|enterprise)(?:e?s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:business(?:person|people|)\||)(business(?: ?m[ae]n|person|es|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:law|lawyer)\||)(attorney|laws?|lawyers?|(?:il|)legal(?:ly|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:board of directors\||)(board|(?:board of |)directors)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:creative|managing|musical|personnel) director)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:film ?making\||)(film ?mak(?:er|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:management\||)(manag(?:e[drs]?|ement|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:private(?:ly held|) |public |listed |quoted |)(?:compan(?:ies|y)|corporations?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:private(?:ly held|) |public |listed |quoted )compan(?:ies|y))\|(private|public|listed|quoted)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:chief executive officer\||)(CEO|C\.E\.O\.|chief executive( officer)?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:chief (?:financial|operating) officer\||)(C[FO]O|C\.[FO]\.O\.|chief (financial|operating) officer)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(headquarter|officer?|official)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:bankruptcy\||)(bankrupt(?:cy|cies|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:resignation\||)(resign(?:ed|ing|ations?|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:strategy\||)(strateg(?:y|ies|ic|ically))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:trade|trading|commerce)\||)(trade|trading|commerce|commercial)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:customs\||)(customs(?: duty| duties| officer| service| tax|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(customers?)\]\]", "$1");
// buildings structure and environment
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bath|bathroom|bed|ceiling|chair|fixture|fitting|gym|kitchen|laundry|shower|(?:swimming |)pool|table|toilet|wall)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(architect(?:ure|)|carpet|cathedral|chapel|construction|fa[cç]ade|floor|furniture|garden(?:ing|)|hospital|home|residen(?:ce|t)|hotel|hous(?:e|ing)|infrastructure|landmark|museum|neighbou?rhood|night club|park|roof|shop(?:ping mall|ping arcade|)|stadium|store?y|skyscraper|interior design(?:er|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:shopping (?:arcade|mall|centre|center)\||)((?:shopping |)(?:arcade|centre|center|mall)(?:s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:church \(building\)\||)(church)(es|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(brick|building|composite|cement|concrete|environment|foundation|glass|steel|structure|wood)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(flat|apartment|room)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:garage \(house\)\||)(garages?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(dam|port|bridge|station|pedestrian|reservoir|road|street|traffic|tunnel|underground|(?:high|free|motor)way)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:high|mid|medium|low)[- ]?rise)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:headquarters\||)(headquarters|headquartered)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:central business district\|)(CBD|central business district|down[ -]?town)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(CBD|central business district|down[-]?town)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:bus|metro|railway|train|tube|underground)(?: stop| station))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:bus|metro|railway|train|tube|underground)(?: stop| station)\|(station)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:environmentalism\||)(environment(?:al(is[mt]|)))\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foobar)\]\]", "$1");
// earth science nouns
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(animal|insect|plant)(s|)\]\](?![ai])", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(cattle|meat|timber|livestock|milk|dairy(?: produce|)|vegetables?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:(?:hu|wo|)man)\||)((?:hu|wo|)m[ae]n)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bear|bird|bull|cat|chicken|crab|dog|dolphin|cow|fish|fox|frog|sheep|goat|human|pig|horse|mouse|mice|octopus|parrot|penguin|pet|(?:sea ?|)lion|rabbit|reptile|seal|snake|spider|tiger|turtle|elephant|giraffe|whale|worm)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beach|cave|cliff|earthquake|forest|grass|hill|island|lagoon|land|lake|mountain|ocean|pond|river|sea|stream|tree|vegetation|weed)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(altitude|elevation|sea level|[hw]eight)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(solid|liquid|gase?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(metal|min(?:ing|e|eral)|gold|iron|iron ore|nickel|alumin(?:a|i?um)|copper|diamond|mineral sands|coal|lead|logging|oil|natural gas|silver)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(plastic|rubber)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(mining\||)(mines?)\]\]", "$1$2");
// tech
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(hi(?:gh|)[ -]?tech)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(address|digit|file|(?:sur|fore|first |last |nick|)name|number|sign(?:ature|)|word|letter|sentence)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(blog|broadband|(?:e-?|)mail|computer|data|personal\scomputer|PC|laptop|laptop\scomputer|(?:cell|cellular|mobile|portable|tele|)[- ]?phone|MP[34](?: player|)|digital audio player|technology|(?:computer |)(?:application|hardware|program|software)|(?:computer |video |)game)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(computer|high|information)( technology|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:SMS|text messaging)\||)(SMS|texting|text messag(?:es?|ing))\]\]", "$1");
// economy
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bank(?:ers?|ing|s|)|capital|cargo|(?:un|)employ(?:e[der]s?|ment)|GDP|gross domestic product|inflation|insurance|invest(?:ed|ing|ments?|ors?)|joint ventures?|loan|money|mortgage|per capita(?: income|)|(?:labou?r |trade |)unions?|utilities)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(credit(?: card|)|pension|welfare)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:finance\||)(financ(?:e|ial|ing|ier))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:wealth\||)(wealthy?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:partnership\||)(partner(?:ed|ing|ship|)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[gross domestic product\|(GDP)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:radio |tv |television |)(?:advert(?:isement|)|commercial|special|network)\||)((?:radio |tv |television |)(?:advert(?:isement|)|commercial|special|network|radio|tv|television))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:demonstration \(people\)\||)(demonstrators?|protest(?:er|)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:strike action\||)(strike(?: action|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:electricity\||)(electric(?:ity|al|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:sales\||)(sales?|salesm[ae]n|sell(?:er|ing|s|)|sold)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(assault|award|club|colou?r|confectionery|cosmetic|down[ -]?town|fire|flower|gambling|gas(?:oline|)|heating|income|information|institut(?:e|ion)|Internet|inventor|job|li[fv]e|magazine|mosque|(?:news|)paper|prize|publicity|organi[sz](?:e|ation)|department|petrol|plastic|(?:air |)pollution|product|salary|school|smog|subsidiary|supermarket|synthesi[sz]er|synagog(?:ue|)|team|television|(?:tv |television |)network|temple|textile|time(?:line|)|wage|water|website|win)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:stage \((?:theater|theatre)\)|theater|theatre)\||)(stages?|theaters?|theatres?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(advertis(?:ing|ement)|brand|creativity|consumer|market(?:ing|)|sign(?:age|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(logo)\]\]", "$1"); //"Logos" is a separate word from logo
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(fruit|apple|banana|garlic|grape|lemon|melon|pear|pumpkin|tomatoe?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(peanut)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(meat|beef|poultry|pork|seafood|butter|candy|cereal|corn|flour|grain|lettuce|wheat|maize|pasta|pastry|pepper|rice|salt|sugar|tobacco|vinegar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(breakfast|lunch|dinner|supper|food|drink|herb|spice|beverage|biscuit|dessert|tea|chocolate|coffee|juice|carrot|onion|potatoe?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:agriculture|horticulture)\||)((agri|horti)(culture|cultural))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[orange \(fruit\)\|(oranges?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(cook|cooking|recipe|oven)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:tele|)communic(?:ation|ate))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(air(?:craft|line|plane|port|)|ambulance|aviation|bus|logistics|transport(?:ation|)|train|tram|)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(exploration|trad(e|ing)|shipping|outsourcing)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:rail transport\||)(rails?|railways?|rail transport|railroads?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:retail(?:er|ing|)\||)(retail(?:er|ing|)|(?:retail |)shop)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:wholesale(?:r|)\||)(wholesale(?:r|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:econom(?:ics|y)\||)(econom(?:ical|ics?|ists?|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:economic growth\||)((?:economic |)growth)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:statistics\||)(statistics?|statisticians?|statistical)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(profit(?:able|ability|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((im|ex)(port(?:er|ing|s|)))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((immi|emi)(grate[sd]|gration))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:factory\||)(factor(?:y|ies)|manufactur(?:er?|ing(?: plant|)))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(coal min(e[rs]?|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:farming\||)(farm(er|s|ing|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:history\||)(histor(?:ical|ian|ies|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(baker|grocer)(ies|y|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beauty (?:parlour|salon)|confectioner|convenience store|florist|gift(?: shop|)|green ?grocer|hardware store|hair ?dresser|newsagent)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:self.service laundry\||)(laundr(?:ette|omat|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:non-?profit\sorgani[sz]ation\||)(non-?profit\sorgani[sz]ations?|non-?profit)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:non-?(?:governmental|profit)\sorgani[sz]ation\||)(non-?(?:governmental|profit)\sorgani[sz]ation|NGO)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:charity \(practice\)|charitable\sorgani[sz]ation)\||)(charitable\sorgani[sz]ations?|charit(?:able|ies|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(post office)\]\]", "$1");
// colours
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foo|fooo)(bar)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(strawberry |platinum |)(blonde?)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:blonde?\||)(blond hair)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(light.|dark.|)(beige|black|brown|blue|crimson|gr[ae]y|green|maroon|orange|pink|purple|red|violet|white|yellow)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:royal.|navy.)blue\||)(royal.|navy.)(blue|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:grey\||)(gr[ae]y)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[[^\(\[\]]* \(colou?r\)\|([^\]]*)\]\]", "$1");
//sociology, race & education
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[H\.E\.?\]\])(?= ?\[\[|\n)", "His Excellency");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[(Sri)\.?\]\]|Sri) (?=\[\[)", "");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Dame|Mrs?|Rev|Lady|Sir|Sri)\.?\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Malay styles and titles\||)(Dat(?:o'?|uk))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Doctor \(title\)\||)(Dr.?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:The Honou?rable\||)((?:The |)Hon.)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Knight Bachelor\||)(Sir)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(academ(?:ic|ies|y)|class(?:room|)|campuse?|colleague|community|degree|(?:co-?|)education(?:al|)|household|lectur(?:e[rs]?|ing)|person|people|(?:assistant |visiting |)professors?|educators?|intellectuals?|scholar(?:ships?|)|teach(?:ers?)?|head(?:masters?|mistress| teachers?)|society|sociology|students?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:head teacher\||)(head(?: teacher| ?master| ?mistress))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(student(:s'?|) union)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[)(freshman)(?:\]\]) year", "first year");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[)(sophomore)(?:\]\]) year", "second year");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:discrimin|gradu)ation\||)((?:discrimin|gradu)at(e[ds]?|ion|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:philanthropy\||)(philanthrop(?:y|ic|ist))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:eccentricity \(behaviou?r\)\||)(eccentric(?:ities|ity|s?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:theology\||)(theolog(?:y|ians?|ies))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:political |social |)activis[mt]\||)((?:political |social |)activis[mt])\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(educat(?:e[ds]?|ion|ional)|health[ -]?care)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(boy|girl)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foster[ -]?|god[ -]?|grand[ -]?|step[ -]?|)(family|father|mother|parent|cousin|twin)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(father|mother|parent|sister|brother|son|daughter|cousin)(s|)(-in-law)\]\]", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:child(?:ren|)\||)(baby|sons?|daughters?|child(?:ren|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:sibling\||)(sister|brother|sibling)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:spouse\||)(husband|wife)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:adolescence\||)(adolescen(?:ce|t)|teen(?:ager|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:great[ -]?|)(?:aunt|uncle|niece|nephew)(?:s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Latinos?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:African|Asian|Chinese|Irish|Italian|Latino).Americans?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((fashion|gay|pop)\sicons?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Native Americans in the United States\|(Native Americans?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Nobel Prize)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[professional [\w]*?\|(professional)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(adventurer|celebrit(?:y|ies)|[bm]illionaires?|class|poor|poverty(?: line|)|rich|socialites?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:conservation(?:ist|)\||)(conservation(ist|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(public (?:housing|transport))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:gossip|rumor|speculation\||)(gossip|rumou?r|speculation)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:society\||)(societ(al|y|ies))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(centrist|moderate|radical|extremist)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:left|right)[ -]wing politics\||)(left|right)([- ]wing(e[dr]|))\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(center|centre|extreme|far)([- ])(left|right)\]\]", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:social class\||)(middle|social|upper|working)(.class|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:social class\||)(class)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(curriculum|discussion|examination|skill)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(thes[ie]s)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(certificate|under-?graduate|Bachelor of Arts|Bachelor of Sciences?|Doctor of Philosophy|college|diplomas?|doctorates?|post-?graduate|Master['’]?s degree|honorary degree)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(\sschools?|\seducation))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(?:\sschools?|\seducation)\|)((?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(\sschools?|\seducation|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:university\||)(universit(?:ies|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(B|M)\.?(A|S|Sc)\.?\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Doctor of philosophy\||)Ph\.? ?D\.?\]\]", "PhD");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:university|master\'?s|graduate|bachelor\'?s|post-?graduate|postgrad)\sdegree\|(degree)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Master of Business Administration\|(?:M\.B\.A\.|MBA)\]\]", "MBA");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:Bachelor|Doctor|Master)s? of [A-Z]\w*)\|([A-Z]\w*)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:Bachelor|Doctor|Master)s? of [A-Z]\w*)\|([A-Z])\.([A-Z]\w*)\.\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:honoris causa\||)(honorary degree)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(alma mater)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(research(?:ers?|))\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([^\]]{1,26})\,\s(Cambridge|Oxford|London)\|([^\]]{1,26})\]\]\,?\s(Cambridge|Oxford|London)(\sUniversity|)", "[[$1, $2]]");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(University of (Oxford|Cambridge)|Oxford University|Cambridge University)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:University of (?:Oxford|Cambridge))\|(Oxford University|Cambridge University)\]\]", "[[$1]]"); //retraining
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([^\]]{1,26})\,\s(Cambridge|Oxford|London)(\sUniversity|)\|([^\]]{1,26})\]\]\,?\s\[\[(Cambridge|Oxford|London)(\sUniversity|)(?:\|\2|)\]\]", "[[$1, $2]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Harvard|Harvard University|Yale|Yale University)\|((Harvard |Yale)|University of (?:Harvard |Yale))\]\]", "[[$1]]");
// lifestyle & religion
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:lifestyle \(sociology\)\||)(life[ -]?style)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:popularity\||)(popular(?:ity|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:personal life\||)((?:everyday |personal )life)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beer|bread|brew(?:ery|ing|)|caf[eé]|cake|cheese|fast food|fat|modern|nutrition|restaurant|smoking|wine)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:moderni[sz]ation\||)(modern(?:i[sz]e[sdr]?|i[sz]ation))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:bar \((?:counter|establishment)\)\||)(bars?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:catering\||)(cater(?:ers?|ing|s?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:champagne \(wine\)\||)(champagne)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:addict(?:ion|)\||)(addict(?:ed|ion|ive|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:alcohol(?:ism|)\||)(alcohol(?:ic(?:| beverages?)|ism|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:tourism\||)(touris[mt]s?|tour guide)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:religion\||)(religio(?:ns?|us))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(anniversary|birthday|centennial|centenary|exercise|(?:film |music |)festival|gays?|god|(?:hetero|homo)sexual|jesus|Christ|Pope|multi-?cultural|racis[mt]|secular|sex|slang|travel)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:lesbianism\||)(lesbian(?:ism|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:vegetarianism\||)(vegetarian(?:ism|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:celibacy\||)(celiba(?:cy|te|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:homosexuality\||)(homosexual(?:ity|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[coming out\|(openly)\]\] (gay|lesbian)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[multiculturalism\|(multicultural)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:homosexuality\||)(homosexual(?:ity|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(popular culture)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi) Jews\|(Askenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\] \[\[(?:(?:jews|judaism)\||)(Jews?\]\])", "[[$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\] \[\[(?:(?:jews|judaism)\||)(Jewish\]\])", "[[$1 Jews|$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)(\]\])( Jews?)", "[[$1$3$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Shia|Sunni) Islam\|(Shia|Sunni)\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Shia|Sunni)\]\] \[\[(?:(?:islam|m[ou]sl[ei]m])\||)((?:islam|m[ou]sl[ei]m])s?\]\])", "[[$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Shia|Sunni)\]\] \[\[(?:(?:islam|m[ou]sl[ei]m])\||)((?:islam|m[ou]sl[ei]m])s?\]\])", "[[$1 Islam|$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Shia|Sunni)(\]\])( (?:islam|m[ou]sl[ei]m])s?)", "[[$1$3$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[Bishop )\((?:Roman |)Catholic(?:ism| church)\)\|", "$1(Catholicism)|"); //repiping
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Roman |)Catholic (?:Arch|)Bishops?\|", "[[Bishop (Catholicism)|"); //repiping
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Roman Catholic)\]\] (\[\[(?:Bishop|Cardinal) \(Catholicism\)\|)((?:Bishop|Cardinal(?:-Deacon|))\]\])", "$2$1 $3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[(?:Bishop|Cardinal) \(Catholicism\)\|(?:Bishop|Cardinal(?:-Deacon|)))\]\]( (?:of|in) the )\[\[((?:Roman |)Catholic Church\]\])", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Priesthood \(Catholic Church\)\|(priesthood)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Parish\|(pastoral)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[Church of England\]\]|Church of England) \[\[(parish church)\]\]", "[[Church of England $1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[(?:Anglicanism\||)Anglican\]\]|Anglican) \[\[(parish church)\]\]", "[[Anglican $1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\| ?architectural type ?= ?)(Church)\|", "$1[[Church (building)|$2]]|");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:agnostic|athie)ism\||)((?:agnostic|athie)(?:ism|sts|s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bible|bishop|cardinal|chaplain|clergy|clergym[ae]n|pastor|prayer|preacher|priest)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:christianity\||)(christians?|christianity|christian\sethic|christian\sfaith)\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:roman\s|)catholic(?:\schurch|ism|)\||)((?:roman\s|)catholic(?:\schurch|ism|s?))\]\]", "$1"); //temporary disabling for work on church articles
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:protestant(?:ism|s|))\|(protestant(?:ism|s|))\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:muslim|islam)\|(moslems?|muslims?|islam(?:ic|))\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:jews|judaism)\|(jews?|jewish|judaism)\]\]", "[[$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(festival)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:child|)birth|rape)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:abortion\||)(abort(?:ed|ion|s))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:pregnancy\||)(pregnan(?:cy|cies|t))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:engagement\||)(engag(?:ed|ment))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:marriage|divorce)\||)(marriage|marry|marries|married|married\scouples?|wed|wedding|spouses?|divorc(?:e[eds]?|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:married and |)maiden names?\||)(maiden names?|née)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(honeymoon|marriage(?: licen[cs]e| certificate|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(burial|cemetery|eulogy|funeral|ghost|graveyard|memorial)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(graves?|tombs?)\]\]", "$1");
// biology, medical, crime
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(emergency|male|female|clinic|doctor|nurse|patient|physician|violence|volunteer)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(tablet|capsule|in[fj]ection|therapy|treatment)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(ankle|arm|brain|chest|elbow|ear|eye|face|finger|foot|hand|hair|head|knee|leg|mouth|nail|nose|pupil|skin|throat|thumb|toe|waist|wrist)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:human |)(ankle|arm|brain|chest|elbow|ear|eye|face|finger|foot|hand|hair|head|knee|leg|mouth|nail|nose|pupil|skin|throat|thumb|toe|waist|wrist)\|\1\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(blood)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bacteri(?:um|a)|disease|epidemic|fung(?:us|i)|health|viruse?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:medicine\||)(medic(?:al|ation|inal|ines?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:therapy\||)(therap(?:eutic|ies|y))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:death\||)(dead|death|die[ds]?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:blindness\||)(blind(ed|ing|s|ness))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:physician\||)(physicians?|doctors?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:surgery\||)(surgery|surgeons?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(cigarettes?|cigars?|smoking|tobacco)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beauty|happiness|(?:sad|shy)ness|adventure|loves?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(tattoos?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:crime\||)(crim(?:e|inal|inality)(|s))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:acquittal\||)(acquit(?:ted|ting|tal|)(|s))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:indictment\||)(indict(?:ed|ing|ment|)(|s))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:machine |shot |)gun|rifle)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(arson|burglar(?:y|ie)|bullet|drug trafficking|forger(?:y|ie)|fraud|fugitive|murder|riot|robber(?:y|ie)|security(?: guard|)|shooting|suspect|theft)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(arrest|trial|[bj]ail|execution|firing squad|jury|parole)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Capital punishment\||)(Capital punishment|death(?: penalty|)|execut(?:ions?|ed?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:traffic\scollision\||)(automobile\saccident|car\saccident|car\scrash|(?:road\s|)traffic\saccident|traffic\scollision)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(AIDS|HIV|bleed(?:ing|)|brain (damage|tumour)|(breast |lung |throat |)cancer|(?:clinical\s|)depression|coma|cough|(?:heart|kidney) failure|fever|fractures?|(?:drug |)overdose|gunshot wounds?|headache|ill|illness|injur(?:y|ies)|shock|stroke|suicide|surgery|vomit(?:ing|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:clinical\sdepression|depression\s\(mood\))\||)(clinical\sdepression|depression\s\(mood\)|depression|depressed)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:myocardial infarction\||)(heart attack|cardiac arrest)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:police|police (?:force|officer|station))\||)(polic(?:e force|e(wo|)m[ae]n|e officers?|ing|e[ds]?|e station))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(police |private |)(detectives?)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(prisons?)\]\]", "$1");
//music & media
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:mononym\||)(mononymously)\]\]", "simply");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((print |published |mass |broadcast |news |)media)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(anthology|messages?|press conference)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:media \(communication\)|print media|published media|mass media|broadcast media|news media|news media \(United States\))\|((mass.|)media)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(porn|pornograph(y|ic))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:child|film|movie|pornographic|stage|television|voice) act(?:ing|or)\||)((?:child|film|movie|porn(ographic|)|stage|television|tv|voice) (actors?|actress(es|)|artists?|stars?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[play \(theatre\)\|(plays?|theatrical|thesbian)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[act(?:ing|or)\|([^\[\]]*)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[leading (actor|actresse?|(?:title|lead|leading) role)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:title|lead|leading) actor\||)((?:title|lead|leading)( role|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:acting\||)(actor|acting|actresse?|thesbian)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:spokesperson\||)(spokes(?:(?:wo|)m[ae]n|person|models?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:model\s\((?:art|fashion|person|profession)\)\||)((?:fashion[ -]|super[ -]?|)models?|modell?ing)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[dis[ck]\sjockey\|([^\]]{1,15})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:radio broadcasting\||)(radio( broadcast|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:performing|visual) arts\||)((?:perform(?:ances?|ing|e[dr]s?|s|)|visual)(?: artists?|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(fine art)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(biographical film)\||)(?:biopic)\]\]", "biographical film");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:action film\||)(action)\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foobar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[spin-off \(media\)\|(spin[ -]?off)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(animation|animated|film[ -]?mak(?:er|ing|)|broadcast(?:ing|)|comedy|documentar(?:y|ies)|drama|episode|pen.name|live.action|new|play|plot|prime[ -]?time|science.fiction|sci-fi|short film|special effects|stage|spin[ -]?off|stage.name)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:entertainment(?: industry|)\||)(entertain(?:e[dr]|ment|s?)|show.?(?:biz|business))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:film|music|sex) industry\||)(film|music|sex)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(([^\s:\|]*?)[\s-]documentary)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(documentary\s([\w]*?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(([^\s:\|]*?)[\s-]documentary\s([\w]*?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(pilot( episode|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Television pilot|Pilot \(television episode\))\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:media|radio|tv|television) (?:announcers?|hosts?|personality|presenters?|stations?)\|(media|radio |tv |television |)(announcers?|broadcaster|hosts?|personalit(ies|y)|presenters?|stations?)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:celebrity|hosts?|personality|presenters?)\||)(media |radio |tv |television |)(announcer|broadcaster|hosts?|personalit(ies|y)|presenters?|stations?)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(Drama\s[Pp]refecture\]\])", "$1:$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(drama\s([\w]*?))\]\]", "$1");
// rem piped music & media
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[animat(?:ion|ed|ed film|or)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:documentary|documentary film)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:situation comedy\||)(sit[ -]?com|situation comedy)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:soap opera\||)(soap(?: opera|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:documentary film|documentary \(film\)|documentary)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:Serial \(radio and television\)|serial)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((television|tv) (film|movie|pilot|program(me|)|(mini[ -]?|)series|show)(s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:drama|dramatic programming)\||)(drama series|drama films?|tv drama|television drama)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:reality\s(?:television|show|tv))\||)(reality(?: show| tv| television|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:television\sprogram(?:me)?|tv program(?:me)?)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:talk|chat|talent|game|variety).show\||)((?:talk|chat|talent|game|variety)(.?show|)( host|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[([^\W\s:\]]*?\s?)(television series|television film?|television show?|tv series|television\sprogram|tv program|television\ssitcom|tv sitcom)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:television series|television film?|television show?|tv series|television\sprogram|tv program|television\ssitcom|tv sitcom)\|([^\]]+?)\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:rock\smusic|rock\s\(music\))\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(?:\[\[(?:(?:Great Britain|United Kingdom)\||)British\]\]|British) \[\[(?:rock music\||)(rock(?: music)?)\]\]", "[[British rock]]");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[pop\smusic\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:singing|singer)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(soundtrack)(\salbum|)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:demo|single|solo) \(music\)\||)(demo|single|solo)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(beat|notes?|rhythms?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(black (?:&|and) white)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(audio ?tape|cassette|DVD|LP|VHS|video|music video|compact\sdis[ck]|CD|C\.D\.|Compact Disc single|C\. D\. single|CD single)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[compact\sdis[ck]\|(?:CD|C\.D\.)(s|)\]\]", "CD$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(CDROM)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:albums?|album track|albums? \(music\)|record albums?)\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:debut |music |record |self.titled debut |sophomore |studio |live |)album)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:music|radio|recording|tv|television) (?:artist|studio))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:music|radio|recording|tv|television) (?:artist|studio))\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:performing |)(?:art(?:ist|)|music(?:ian|))\||)(artists?|musicians?|performers?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Facebook|MySpace|Twitter|You\s?Tube)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(singing|singer|vocal|vocalist|Pop\ssinger|Female\svocals|Songstress|Clean\svocals|Singer\s\(music\)|Pop\ssinger)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:backing|lead) (?:singer|vocals|vocalist)\||)((?:backing|lead)(?: singer| vocal| vocalist|)(?:s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:human voice|(?:playback |)singer|singing|vocals|vocalist)\||)((?:playback |)(?:singer|vocal|vocalist|voice)(?:s|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(classical |jazz |musical |pop |rock |)(band|ensemble|music|musician|group|standard|song)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(classical|dance|pop|rap|rock|soul|jazz) music\|\1\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:band\s\(music\)|group\s\(music\)|musical\sensemble|musical (?:band|group))\||)(musical\sensemble|group|band|rock\sbands?|Instrumental\sensemble|Rock\sgroups?|list\sof\smusical\sensembles|musical\sgroup|music\sband|music\sgroup|musical\sband|bar\sband|musical\sensembles?|music\sensemble|pop\sband)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\[\[)(acoustic |bass |blues |classical |electric |lead |rhythm )\((guitar)\s?\)(?=[\|\]])", "$1$2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:acoustic |blues |classical |electric |lead |rhythm |)(?:guitar|guitarist)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:[^\]]+?) guitar\|((?:bass|electric|lead|rhythm)(?:\sguitar|))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:bass\s|electric\s|lead\s|rhythm\s|)guitars?\|([^\]]+?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(bass|bassist|bass guitarists?|double\sbass|electric\sbass|metal\sbass|electric\sbass\sguitar|Alternate\sbass|bass\sguitars?|fretless\sbass\sguitar|base\sguitar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:keyboard\sinstruments?|musical keyboards?)\||)(keyboard(?:\sinstrument|ist|)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:drum[ -]?kit|drummer)\||)(drums?|drum ?kits?|drumming|drummers?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:percussion\sinstrument\||)(percussion\sinstrument|percussion|percussionist)(|s)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(harmonica)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:wood|)wind\sinstrument\||)(wood|)(wind\sinstruments?|wind)\]\]", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:violin\||)(violinists?|violins?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:saxophone\||)(saxophon(?:e|ist)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:violin|)cello\||)(cellists?|cellos?)\]\]", "$1");
// other musical instruments inside infoboxes
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*?[Ii]nstrument[ ]*=[^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\](?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?=[ ]*?\|)", "$1$2$3$4$5$6$7$8$9$10");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\|[ ]*?[Ii]nstrument[ ]*=[^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\](?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?=[ ]*?\|)", "$1$2$3$4$5$6$7$8$9$10"); //repeat
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:fashion\sdesign\||)(fashion|fashion\sdesign|fashion\sdesigners?|designers?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:se|pre)quels?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(box office|concerto?|opera|orchestra|repertoire)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:film\||)(cinema|(?:feature |)films?|filming|movies?|big\sscreen|motion pictures?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:(?:music(?:al|)\s|)arranger|arrangement)\||)(music(?:al|)\sarranger|arranger|arrangement)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:executive|film|stage|television|tv|theat(?:er|re|rical)|music|radio|record) (?:direc|distribu|edi|produc)(?:t?ing|tion|tor|er))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:executive|film|stage|television|tv|theat(?:er|re|rical)|music|radio|record)\s(?:direc|distribu|edi|produc)(?:t?ing|tion|tor|er)\||)(executive|film|music|production assistant|television|tv|theat(?:er|re|rical)|radio|record|(?:direc|distribu|edi|produc)(?:t?ing|ted|ts?|tion|tors?|e[dsr]?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:music\sexecutive\||)(music\sexecutive|arranger)\]\]", "$1");
// literary
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(foobar)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:stand[ -]?up |)comedy\||)(?:stand[ -]?up |)(comedy|comedies|comic(?: book|)s?|comedians?|comediennes?|stand[ -]?up)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:poetry\||)(poe([mt]s?|tic|try))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:best[- ]?seller\||)(best[- ]?sell(ers?|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[hardcover\|(hard ?back|hard ?cover)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[((?:hard|paper)(?:back|cover))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)Print \(Hard(back|cover) (&|and) Paperback\)", "Print (hardback & paperback)");
ArticleText=Regex.Replace(ArticleText, @"(?i)Print \(Hard(back|cover)\)", "Print (hard$1)");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:fiction(?:al character)?|Character \(arts\))\||)(fictional|(?:fictional |)character)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[non.?fiction\]\]", "non-fiction");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(books?|diary|horror|humou?r(?:ist|)|(?:adult |children's |teen |)literature|(?:historical |)fiction|screenplay|magazine|(?:(?:auto.?)biograph|histor)ical novel|(?:s|pr)equel|satir(?:e|ist)|short[- ]stor(?:ies|y)|suspense|thriller|trilogy)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:creative writing\||)((?:creative |)writ(?:er|ing))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:orator|public speak(?:er|ing))\||)((?:public |)speaker)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:author|writer)\||)(?:author|writer)\]\]", "author");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:memoir(?:ist|)\||)(memoir(?:ist|s?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:espionage\||)(spy(?:ing|)|spies)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:sabotage\||)(saboteur)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:interpret|translat)(?:ion|[eo]r)\||)((?:interpret|translat)(?:ion|ing|[eo]rs?))\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:essay\||)(essays?|essayists?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:encyclopa?edia\||)(encyclopa?edi[ac])\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:writers\||)(writer)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:story[- ]?telling\||)(story[- ]?teller)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(Wikipedia)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:novel|novella)\||)(novels?|novella|novell?ist)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:narrat(?:e|ion|or))\||)(narrat(?:e|ion|ive|or)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:plot \(narrative\)\||)(plots?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(picture books?)\]\]", "$1");
// ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:(?:fantasy|romance|children's)(?: novel| literature)\||)(myth|fantasy|romance|children's)( books?| novel| literature|)\]\]", "$1$2");
// sport
ArticleText=Regex.Replace(ArticleText, @"(?i)\[(football \(soccer\)|soccer)\|", "[association football|");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(athlete|athletics|badminton|baseball|basketball|football(ers?|\splayers?|)|golf|gymnast(ics|)|hiking|hunting|martial arts|run(ning|ners?|)|sailing|soccer|sports?|table tennis|track and field|volleyball)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:track and field|athletics \(sport\))\|(track|field|athlet(?:ic|e)s?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:human swimming|swimming \(sport\))\|(swimming|swimmer|sw[aiu]ms?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(?:tennis\||)(tennis|tennis\scourts?|tennis players?)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(grass courts?|clay courts?|hard courts?|grand\sslam)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(\d ?)(?:]\]|)(-|–|—|–)Present", "$1–present");
return ht.AddBack(ArticleText);
return ArticleText;
}