Jump to content

User:BattyBot/Persondata

From Wikipedia, the free encyclopedia
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
 {
  Skip = false;
  Summary = "";
//-----
//This custom module is designed to remove the deprecated {{Persondata}} template
//ONLY when the values in the {{Persondata}} parameters are also contained in
//the lead and/or infobox parameters and/or categories.
//-----
//Remove Persondata comment
  ArticleText = Regex.Replace(ArticleText, @"(?i) *<!-- Metadata: see \[\[Wikipedia:Persondata\]\]\.? -->", "");
//Remove Persondata ALTERNATIVE NAMES
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *(?:birth_name|other_names) *= *)([\w ]+)(.*?{{Persondata.*?\| *ALTERNATIVE NAMES *= *)\2", "$1$2$3", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *(?:birth_name|other_names) *= *)([\w ]+) (\w+)(.*?ALTERNATIVE NAMES *= *)\3, \2", "$1$2 $3$4", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *NAME *= *)([\w\,\- ]+)(.*?ALTERNATIVE NAMES *= *)\2", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata SHORT DESCRIPTION (category)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *SHORT DESCRIPTION *= *)([\w- ]+)businessman(.*?\[\[Category:[\w- ]*\2businesspeople\]\])", "$1$3", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *SHORT DESCRIPTION *= *)([\w'\-]+) +([\w'\-]+)(.*?\[\[Category:\2 \w+ \3e?s?\]\])", "$1$4", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *SHORT DESCRIPTION *= *)\[*([\w'\- ]+)\]*(.*?\[\[Category:[\w- ]*\2e?s?[\w- ]*\]\])", "$1$3", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH/DEATH (lead)
  ArticleText = Regex.Replace(ArticleText, @"(?i)(''' \()([\w, ]+)( *(?:–|&ndash;) *)([\w, ]+)(.*{{Persondata.*?\| *DATE OF BIRTH *= *)\2(.*?\| *DATE OF DEATH *= *)\4", "$1$2$3$4$5$6", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH (infobox bda)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth[_ ]date(?:[_ ]and[_ ]age)? *\| *(?:[dm]f=yes\|)?)(\d{4}) *\| *(\d{1,2}) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)\2-0?\3-0?\4", "$1$2|$3|$4$5", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH (category)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *DATE OF BIRTH *= *)(\d{3,4})(.*?\[\[Category:\2 births\]\])", "$1$3", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH (lead)
  ArticleText = Regex.Replace(ArticleText, @"(?i)(''' \(born )([\w, ]+)(.*{{Persondata.*?\| *DATE OF BIRTH *= *)\2", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH (infobox bda months)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?1) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:January \4,|\4 January) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?2) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:February \4,|\4 February) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?3) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:March \4,|\4 March) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?4) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:April \4,|\4 April) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?5) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:May \4,|\4 May) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?6) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:June \4,|\4 June) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?7) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:July \4,|\4 July) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?8) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:August \4,|\4 August) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?9) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:September \4,|\4 September) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(10) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:October \4,|\4 October) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(11) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:November \4,|\4 November) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(12) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:December \4,|\4 December) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?1) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:January \4,|\4 January) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?2) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:February \4,|\4 February) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?3) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:March \4,|\4 March) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?4) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:April \4,|\4 April) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?5) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:May \4,|\4 May) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?6) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:June \4,|\4 June) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?7) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:July \4,|\4 July) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?8) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:August \4,|\4 August) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?9) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:September \4,|\4 September) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(10) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:October \4,|\4 October) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(11) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:November \4,|\4 November) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *{{birth date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(12) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)(?:December \4,|\4 December) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
//Remove Persondata DATE OF BIRTH (infobox)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_date *= *)([\w \.,]+)(.*?{{Persondata.*?\| *DATE OF BIRTH *= *)\2", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata PLACE OF BIRTH (infobox)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *birth_place *= *(?:\[\[)?)([\w\- \.\,'\|\(\)\[\]]+)((?:\]\])?.*?{{Persondata.*?\| *PLACE OF BIRTH *= *)\2\.?", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata PLACE OF BIRTH (category)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *PLACE OF BIRTH *= *)([\w\s]+)(.*?\[\[Category:People from \2\]\])", "$1$3", RegexOptions.Singleline);
//Remove Persondata DATE OF DEATH (lead)
  ArticleText = Regex.Replace(ArticleText, @"(?i)(''' \(died )([\w, ]+)(.*{{Persondata.*?\| *DATE OF DEATH *= *)\2", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata DATE OF DEATH (infobox dda)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(\d{1,2}) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)\2-0?\3-0?\4", "$1$2|$3|$4$5", RegexOptions.Singleline);
//Remove Persondata DATE OF DEATH (category)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Persondata.*?\| *DATE OF DEATH *= *)(\d{3,4})(.*?\[\[Category:\2 deaths\]\])", "$1$3", RegexOptions.Singleline);
//Remove Persondata DATE OF DEATH (infobox dda months)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?1) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:January \4,|\4 January) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?2) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:February \4,|\4 February) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?3) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:March \4,|\4 March) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?4) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:April \4,|\4 April) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?5) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:May \4,|\4 May) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?6) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:June \4,|\4 June) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?7) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:July \4,|\4 July) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?8) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:August \4,|\4 August) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?9) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:September \4,|\4 September) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(10) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:October \4,|\4 October) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(11) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:November \4,|\4 November) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(12) *\| *(\d{1,2})(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:December \4,|\4 December) \2", "$1$2|$3|$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?1) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:January \4,|\4 January) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?2) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:February \4,|\4 February) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?3) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:March \4,|\4 March) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?4) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:April \4,|\4 April) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?5) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:May \4,|\4 May) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?6) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:June \4,|\4 June) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?7) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:July \4,|\4 July) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?8) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:August \4,|\4 August) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(0?9) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:September \4,|\4 September) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(10) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:October \4,|\4 October) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(11) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:November \4,|\4 November) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *{{death date(?: and age)? *\| *(?:[dm]f=y(?:es)?\|)?)(\d{4}) *\| *(12) *\| *0(\d)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)(?:December \4,|\4 December) \2", "$1$2|$3|0$4$5", RegexOptions.Singleline);
//Remove Persondata DATE OF DEATH (infobox)
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_date *= *)([\w \.,]+)(.*?{{Persondata.*?\| *DATE OF DEATH *= *)\2", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata PLACE OF DEATH
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_place *= *\[\[)([\w\- \.\,']+)(\]\], \[\[)([\w\- \.\,']+)((?:\]\])?.*?{{Persondata.*?\| *PLACE OF DEATH *= *)\2, \4\.?", "$1$2$3$4$5", RegexOptions.Singleline);
  ArticleText = Regex.Replace(ArticleText, @"(?i)({{Infobox .*?\| *death_place *= *(?:\[\[)?)([\w\- \.\,'\|\(\)\[\]]+)((?:\]\])?.*?{{Persondata.*?\| *PLACE OF DEATH *= *)\2\.?", "$1$2$3", RegexOptions.Singleline);
//Remove Persondata with only NAME
  ArticleText = Regex.Replace(ArticleText, @"(?i){{Persondata\s*\n\s*\|\s*NAME\s*=[\w\.,\-\s]*\n+(?:\s*\|\s*ALTERNATIVE NAMES\s*=\s*\n+)?\s*\|\s*SHORT DESCRIPTION\s*=\s*\n+\s*\|\s*DATE OF BIRTH\s*=\s*\n+\s*\|\s*PLACE OF BIRTH\s*=\s*\n+\s*\|\s*DATE OF DEATH\s*=\s*\n+\s*\|\s*PLACE OF DEATH\s*=\s*\n?}}", "", RegexOptions.Singleline);
//Remove empty Persondata
  ArticleText = Regex.Replace(ArticleText, @"(?i){{Persondata *}}", "");
 return ArticleText;
 }