//add metric units
//
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 = "";
//Protect images, quotes etc by removing them
//ArticleText = ht.Hide(ArticleText);
ArticleText = ht.HideMore(ArticleText);
//remove flagicons from birth and death
ArticleText=Regex.Replace(ArticleText, @"(?i)(birth\s?=\s?)\{\{flagicon\|[^\}]+\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(death\s?=\s?)\{\{flagicon\|[^\}]+\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(birth_?place\s?=\s?)\{\{flagicon\|[^\}]+\}\}", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(death_?place\s?=\s?)\{\{flagicon\|[^\}]+\}\}", "$1");
//symbol for 'times'
//ArticleText=Regex.Replace(ArticleText, @"(?i)×", "×");
//turn letter 'x' into symbol '×'
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\sx\s(\d{1,3})\sin\s\(", "$1 × $2 in (");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\sx\s(\d{1,3})\sinch\s", "$1 × $2 inch ");
// Convert degree symbols into ° symbol, ensure preceding space
ArticleText=Regex.Replace(ArticleText, @"°", "°");
//ArticleText=Regex.Replace(ArticleText, @"º", "°");
//aviation specifications: protect 'main=' and 'alt=' - undone below
ArticleText=Regex.Replace(ArticleText, @"(?i)((?:main|alt)\s?=\s?)(\d)", "$1xx$2");
// Celsius spelling errors
ArticleText=Regex.Replace(ArticleText, @"(?i)celsius", "Celsius");
ArticleText=Regex.Replace(ArticleText, @"(?i)celcius", "Celsius");
//Fix common naming error (be careful with this one)
//ArticleText=Regex.Replace(ArticleText, @"(?i)centigrade", "Celsius");
//Celsius or Fahrenheit
ArticleText=Regex.Replace(ArticleText, @"(\d) (?:°|deg|degree|degrees) ([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:°|deg|degree|degrees) ([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d) (?:°|deg|degree|degrees)([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(\d)(?:\s|)(?:°|deg|degree|degrees)(?:\s|)([CF]\W)", "$1 °$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) (\[\[Celsius|°C\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|)(\[\[Celsius|°C\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) (\[\[Fahrenheit|°F\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|)(\[\[Fahrenheit|°F\]\])", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(-?\d[\d,\.]*)(?:\s|-| |)°F([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|°F|°C|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(-?\d[\d,\.]*)(?:\s|-| |)(?:deg|degree|degrees)(?:\s|-| |)Fahrenheit([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|°F|°C}}$3");
// Convert &sup to superscript
ArticleText=Regex.Replace(ArticleText, @"²", "²");
ArticleText=Regex.Replace(ArticleText, @"³", "³");
//metre
//delink this common unit
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(metres|meters|metre|meter)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(metre|meter)\]\]s([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3s$4");
//space before 'm' only when lower case. Check for dollars and pounds to avoid 'm' used for millions in money.
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*)(?:\s|-|)m([:;,\.?!\s<][^\d\(\)\/\\])", "$1 m$2");
//convert 'metres' to 'm' when in parentheses
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*)(?:\s|-|)(?:metres|meters|metre|meter)(\))", "$1 m$2");
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*) (?:metres|meters|metre|meter)(\))", "$1 m$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:m|ft)[^\}]*)\|lk=(?:on|in|out)", "$1");
//metre per second
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(?:m\/second|m\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 m/s$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) (?:m\/second|m\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 m/s$3");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:m\s|ft\s)[^\}]*)\|lk=(?:on|in|out)", "$1");
//square metre
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-| |)sq(?:\s|\.\s|-| )m([:;,\.?!\s<][^\d\(\)\/\\])", "$1 m²$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:m2|sqft)[^\}]*)\|lk=(?:on|in|out)", "$1");
// kilometre
//delink this common unit
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(kilometres|kilometers|kilometre|kilometer)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*) \[\[(kilometres|kilometers|kilometre|kilometer)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(?:kilometres?|kilometers?)\|(km)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*) \[\[(?:kilometres?|kilometers?)\|(km)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)kms?([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) kms?([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km$3");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:mi|km)[^\}]*)\|lk=(?:on|in|out)", "$1");
//square kilometre
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-| )\[\[km²\]\]", "$1$2km²");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\s?sq\.?(?:\s|-| |)kms?(\s|\.)", "$1 km²$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)00\|ha\|\d(\||})", "$1|km2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)00\|ha", "$1|km2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)(\d)0\|ha\|\d(\||})", "$1.$2|km2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)(\d)0\|ha", "$1.$2|km2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)(\d\d)\|ha\|\d(\||})", "$1.$2|km2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+)(\d\d)\|ha", "$1.$2|km2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|sqmi\|)ha\|\d(\||})", "$1km2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|sqmi\|)ha", "$1km2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d\d\d+\|acre\|)ha\|\d(\||})", "$1km2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d{\d\d+\|acre\|)ha", "$1km2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d\d\d+\|acre)}", "$1|km2}");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d(?:\.\d+|)\|acre)\|ha\|\d(\||})", "$1|m2$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d(?:\.\d+|)\|acre)\|ha", "$1|m2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d(?:\.\d+|)\|acre)}", "$1|m2}");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^\}]*(?:km2|sqmi)[^\}]*)\|lk=(?:on|in|out)", "$1");
//kilometre per second
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(?:km\/second|km\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/s$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) (?:km\/second|km\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/s$3");
// kilometre per hour
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(?:km\/hr|km\/ph|kph|kmph|kmh)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/h$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) (?:km\/hr|km\/ph|kph|kmph|kmh)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/h$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(?:km\/hr|km\/ph|kph|kmph|kmh)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/h$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) \[\[(?:km\/hr|km\/ph|kph|kmph|kmh)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 km/h$3");
//millilitre
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(ml)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
// ensure spaces and correct case in kilowatt
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)kW([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 kW$3");
// ensure spaces and correct case in hertz
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)Hz([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 Hz$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)kHz([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 kHz$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)GHz([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 GHz$3");
// ensure spaces in megahertz. Must be upper case to avoid clashing with millihertz
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)MHz([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 MHz$3");
// frames per second
ArticleText=Regex.Replace(ArticleText, @"(?i)frames\/s([:;,\.?!\s<][^\d\(\)\/\\])", "frame/s$1");
// kilogram
ArticleText=Regex.Replace(ArticleText, @"(?i)kilogrammes", "kilograms");
ArticleText=Regex.Replace(ArticleText, @"(?i)kilogramme", "kilogram");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(kilograms?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*) \[\[(kilograms?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)grammes([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 grams$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)gramme([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 gram$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(?:kgs?|\[\[kg\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 kg$3");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:kg|lb)[^\}]*)\|lk=(?:on|in|out)", "$1");
//carat:plural
//ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[carat\s\(mass\)\|carats\]\]", "[[carat (mass)|carat]]s");
//ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[carats\]\]", "[[carat (mass)|carat]]s");
//ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[carat\]\]", "[[carat (mass)|carat]]");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16}\.\d*)\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16})\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]\.\d*)\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+\.\d*)\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,])\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+)\+?(?:\s|-| |)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//carat:singular
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16}\.\d*)\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16})\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]\.\d*)\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+\.\d*)\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,])\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+)\+?(?:\s|-| |)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//foot
//convert 'foot' to 'ft' when in parentheses
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*)(?:\s|-|)(?:feet|foot)(\))", "$1 ft$2");
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*) (?:feet|foot)(\))", "$1 ft$2");
//remove trailing period when in parentheses
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*)(?:\s|-|)ft\.(\))", "$1 ft$2");
ArticleText=Regex.Replace(ArticleText, @"(\(\d[\d,\.]*) ft\.(\))", "$1 ft$2");
// square foot
//convert 'sq foot' to 'sq ft'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-)sq\.?(\s|-|)(feet|foot|ft)", "$1 sq ft");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) sq\.? (feet|foot|ft)", "$1 sq ft");
//convert 'square ft' to 'sq ft'
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-)square(\s|-)ft", "$1 sq ft");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) square ft", "$1 sq ft");
//square foot: abbreviation
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)sq(?:\s|-| |)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)ft<sup>2<\/sup>([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)square(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)square(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2|abbr=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|sqft|m2|abbr=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|sqft|m2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|sqft|m2|adj=on}}$4");
//square foot: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:square\sfoot|\[\[square\sfoot\]\]|foot<sup>2<\/sup>)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|adj=on}}$3");
//square foot: plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:square\sfeet|\[\[square\sfeet\]\]|feet<sup>2<\/sup>)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2}}$3");
//feet per second
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)(?:ft\/second|ft\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 ft/s$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*) (?:ft\/second|ft\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 ft/s$3");
//feet per second:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)feet\sper\ssecond([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft/s|m/s}}$3");
//feet per second:singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)foot\sper\ssecond([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft/s|m/s|adj=on}}$3");
//feet per second:abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)ft\/s([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft/s|m/s|abbr=on}}$3");
// foot and inch
//ArticleText=Regex.Replace(ArticleText, @"(?i)(ength.{1,3})(\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]", "$1$2 ft $3 in");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(idth.{1,3})(\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]", "$1$2 ft $3 in");
//ArticleText=Regex.Replace(ArticleText, @"([\(\|:]\s?\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]([^NESW])", "$1 ft $2 in$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\s?ft\s?(\d{1,3})\s?in", "$1 ft $2 in");
// yard
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-| |)yds?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 yd$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-| |)sq\.?\s?yds?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 sq yd$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)yd\.\)", "yd)");
//yards: plural
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:yards|\[\[yard\]\]s|\[\[yards\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m}}$3");
//yards: singular
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:yard|\[\[yard\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m|adj=on}}$3");
//yards: abbreviated
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)yd([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m|abbr=on}}$3");
//yards: in full
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sone(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (2 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (3 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (7 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (9 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seleven(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (10 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwelve(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthirteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (12 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfourteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfifteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (14 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssixteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (15 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseventeen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seighteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snineteen(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (17 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwenty(?:\s|-| |)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (18 m)$2");
// knot
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-| )(?:kts|kt|knt)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2knots$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[knot\s\(unit\)\|", "[knot (speed)|");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[kts\]\]", "[[knot (speed)|knots]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|kts\]\]", "|knots]]");
//nautical mile - rename 'miles' as 'nautical miles' when followed by knots or conversion code
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-| |)miles\s(?:at|@)\s([\d\.]{1,9}(?:\s|-| |)knots|{{convert)", "$1 nautical miles at $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-| )(?:mi|nm|nmi)\s(?:at|@)\s([\d\.]{1,9}(?:\s|-| |)knots|{{convert)", "$1$2nmi at $3");
//nautical mile: plural unlinked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)nautical(?:\s|-| |)miles([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km}}$3");
//nautical mile: plural linked with 's' inside link
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)\[\[nautical(?:\s|-| |)miles\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km}}$3");
//nautical mile: plural linked with 's' outside link
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)\[\[nautical(?:\s|-| |)mile\]\]s([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km}}$3");
//nautical mile: singular unlinked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)nautical(?:\s|-| |)mile([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km|adj=on}}$3");
//nautical mile: singular linked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)\[\[nautical(?:\s|-| |)mile\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km|adj=on}}$3");
//nautical mile: abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-| |)(?:\[\[nautical\smile\|nmi?\]\]|nmi|nm)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km|abbr=on}}$3");
//nautical mile: in full
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sone(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1.9 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (7 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (9 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (15 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (17 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seleven(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (20 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwelve(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (22 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthirteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfourteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (26 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfifteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (28 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssixteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (30 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseventeen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (31 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seighteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (33 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snineteen(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (35 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwenty(?:\s|-| |)nautical(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (37 km)$2");
//knot - plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:knots|\[\[knot\s\(speed\)\|(?:knots\]\]|knot\]\]s|kts\]\]|kt\]\]s))([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|kn|km/h}}$3");
//knot - singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:knot|\[\[knot\s\(speed\)\|(?:knot|kt|kn)\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|kn|km/h|adj=on}}$3");
//knot - abbreviation
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:kts?|\[\[knot\s\(speed\)\|(?:kt|kn)\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|kn|km/h|abbr=on}}$3");
//mile - delink this common unit
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|)\[\[(miles?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*) \[\[(miles?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2 $3$4");
//mile - lower case to avoid proper names like 'Five Mile Road'
//mile - protect 'miles per hour' - undone below
ArticleText=Regex.Replace(ArticleText, @"(?i)(miles?)\s(per)", "$1xx$2");
//miles: plural
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:miles|\[\[miles\]\]|\[\[mile\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km}}$3");
//miles: singular
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:mile|\[\[mile\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km|adj=on}}$3");
//miles: abbreviated
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)mi([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km|abbr=on}}$3");
//miles: in full
ArticleText=Regex.Replace(ArticleText, @"([^y]\sone(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1.6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwo(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (3 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sthree(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfour(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfive(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\ssix(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (10 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sseven(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seight(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\snine(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (14 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sten(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seleven(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (18 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwelve(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sthirteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfourteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (21 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfifteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sixteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (26 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sseventeen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (27 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seighteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (29 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\snineteen(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (30 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwenty(?:\s|-| |)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (32 km)$2");
//mile - unprotect 'miles per hour'
ArticleText=Regex.Replace(ArticleText, @"(?i)(miles?)xx(per)", "$1 $2");
//mile per hour
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)m\.?p\.?h([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi/h|km/h|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)mph([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi/h|km/h|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)miles(?:\s|-| |)per(?:\s|-| |)hour([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi/h|km/h}}$3");
// square mile
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-)sq(?:\s|\.\s|-)mi([:;,\.?!\s<][^\d\(\)\/\\])", "$1 sq mi$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[(square\smile)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[square\smile\|(sq\smi)\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)(sq)(?:\s|-| |)(mile)", "$1uare $2");
// square mile:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)square(?:\s|-| |)miles([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2}}$3");
// square mile:singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)square(?:\s|-| |)mile([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2|adj=on}}$3");
// square mile:abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)sq(?:\s|-| |)mi([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2|abbr=on}}$3");
//acre foot:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-| |)million(?:\s|-| |)acre(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-| |)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)acre(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)\.(\d\d)(?:\s|-| |)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)(?:\s|-| |)million(?:\s|-| |)acre(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)(?:\s|-| |)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)acre(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)\[\[acre(?:\s|-| |)foot\|acre(?:\s|-| |)feet\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet}}$3");
//acre foot:singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-| |)million(?:\s|-| |)acre(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)acre(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)\[\[acre(?:\s|-| |)foot\|acre(?:\s|-| |)feet\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet|adj=on}}$3");
//acre foot:abbreviation
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:acre|ac\.?)(?:\s|-| |)(?:foot|feet|ft)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre ft|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)\[\[acre(?:\s|-| |)foot\|acre(?:\s|-| |)ft\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre ft|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)\[\[acre(?:\s|-| |)ft\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre ft|abbr=on}}$3");
//acre
//acres - temporary change to protect acre feet. changed below
ArticleText=Regex.Replace(ArticleText, @"(?i)(acre.feet)", "xtempx$1ytempy");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)-(acre)", "$1 $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-| |)(?:surface|square)(?:\s|-| |)acre", "$1 acre");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)thousand(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)thousand(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|e6acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|e6acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre|km2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre|km2|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre|km2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre|km2|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sone(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\sa(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (12,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (20,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (28,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (32,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (36,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (40,000 km²)$2");
//acre:plural
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)([\d,]+\d\d[\d\.]*)\+?(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d?\d\.\d+|\d?\d)\+?(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|m2}}$3");
//acre:singular
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)([\d,]+\d\d[\d\.]*)\+?(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d?\d\.\d+|\d?\d)\+?(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)one(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|1|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)two(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|2|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)three(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|3|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)four(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|4|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)five(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|5|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)six(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|6|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seven(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|7|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eight(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|8|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nine(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|9|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ten(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|10|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eleven(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|11|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twelve(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|12|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|13|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fourteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|14|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|15|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|16|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventeen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|17|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|18|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nineteen(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|19|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twenty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|20|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|30|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)forty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|40|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|50|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|60|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventy(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|70|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighty(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|80|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ninety(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|90|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^oexntr].)hundred(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|100|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)one(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|1|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)two(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|2|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)three(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|3|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)four(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|4|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)five(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|5|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)six(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|6|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seven(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|7|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eight(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|8|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nine(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|9|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ten(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|10|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eleven(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|11|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twelve(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|12|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|13|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fourteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|14|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|15|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|16|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventeen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|17|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|18|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nineteen(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|19|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twenty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|20|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|30|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)forty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|40|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|50|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|60|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventy(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|70|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighty(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|80|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ninety(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|90|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^oexntr].)hundred(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|100|acre|m2}}$2");
//undo protection for acre feet
ArticleText=Regex.Replace(ArticleText, @"(?i)xtempx(acre.feet)ytempy", "$1");
// foot pound
ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)lbs?[\s-.·•\/]{1,2}ft([^²\w])", "$1ft·lbf$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)lbs?ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1ft·lbf$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)ftlbs?([:;,\.?!\s<][^\d\(\)\/\\])", "ft·lbf$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)ft[\s-.·•\/]{1,2}lbs?([:;,\.?!\s<][^\d\(\)\/\\])", "ft·lbf$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)ftlbs?([:;,\.?!\s<][^\d\(\)\/\\])", "ft·lbf$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)ft[\s-.·•\/]{1,2}lbf([^\|])", "ft·lbf$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)ft[\s-.·•\/]{1,2}lbff", "ft·lbf");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pounds?(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)foot(?:\s|-| |)pounds([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pound(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)foot(?:\s|-| |)pound([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)ft.lbf([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m|abbr=on}}$3");
// pound force
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(\s|-| |)lbs?.?\s(thrust|of\sthrust|force|of\sforce)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2$3lbf $4$5");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*000)(?:\s|-| |)pounds\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pounds\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|N}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*000)(?:\s|-| |)pound\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pound\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|N|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*000)(?:\s|-| |)lbf([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)lbf([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|abbr=on}}$3");
// pound weight. Parsed after foot pound and pound force
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[pound\s\(weight\)\|([^\]]+)\]\]", "[[pound (mass)|$1]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)\|lbs?\.\]\]", "|lb]]");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\s?lbs?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 lb$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d\+?)\s?lbs?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 lb$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) lbs?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 lb$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)lb([:;,\.?!\s][^\d\(\)\/\\])", "$1{{convert|$2|lb|abbr=on}}$3");
//pounds and ounces - plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pounds(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)ounces?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lb|$3|oz|kg}}$4");
//pounds and ounces - singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)pound(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)ounces?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lb|$3|oz|kg|adj=on}}$4");
//pounds and ounces - abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)lbs?\.?,?(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)oz\.?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lb|$3|oz|kg|abbr=on}}$4");
//foot and inch: plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)feet\.?(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)(?:in|ins|inch|inches)\.?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|$3|in|m}}$4");
//foot and inch: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)foot\.?(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)(?:in|ins|inch|inches)\.?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|$3|in|m|adj=on}}$4");
//foot and inch: abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)ft\.?(?:\s|-| |)(\d[\d,\.]*)(?:\s|-| |)(?:in|ins|inch|inches)\.?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|$3|in|m|abbr=on}}$4");
//foot (again). Parsed after 'foot per second' and 'foot pound'
//foot: plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)linear(?:\s|-| |)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m}}$3");
//foot: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m|adj=on}}$3");
//foot: abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)ft\.?([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m|abbr=on}}$3");
//inch - protect 'nine inch nails (band)'
ArticleText=Regex.Replace(ArticleText, @"(Nine)\s(Inch\sNails)", "$1xx$2");
//inch: plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\Wt'’]\s)(\d[\d,\.]*)(?:\s|-| |)inches([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|in|mm}}$3");
// inch: plural with number in words
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthree(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (76 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfour(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (102 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfive(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (127 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssix(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (152 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sseven(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (178 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seight(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (203 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\snine(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (229 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sten(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (254 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seleven(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (279 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\stwelve(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (305 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthirteen(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (330 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfourteen(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (356 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfifteen(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (381 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssixteen(?:\s|-| |)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (406 mm) $2");
//inch: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\Wt'’]\s)(\d[\d,\.]*)(?:\s|-| |)(?:inch|\[\[inch\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|in|mm|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:in|mm|cm)[^\}]*)\|lk=(?:on|in|out)", "$1");
// inch: singular with number in words
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthree(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (76 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfour(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (102 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfive(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (127 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssix(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (152 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sseven(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (178 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seight(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (203 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\snine(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (229 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sten(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (254 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seleven(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (279 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\stwelve(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (305 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthirteen(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (330 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfourteen(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (356 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfifteen(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (381 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssixteen(?:\s|-| |)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (406 mm) $2");
//inch - unprotect 'nine inch nails (band)'
ArticleText=Regex.Replace(ArticleText, @"(Nine)xx(Inch\sNails)", "$1 $2");
// horsepower
ArticleText=Regex.Replace(ArticleText, @"(?i)\.28\s?(bhp|ihp|shp)\.29\|", "($1)|");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-|)(horsepower|hp|bhp|ihp|shp)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 $2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) (horsepower|hp|bhp|ihp|shp)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 $2$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-|)horse(?:\s|-|)power([:;,\.?!\s<][^\d\(\)\/\\])", "$1 horsepower$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(?:horsepower|\[\[horsepower\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|hp}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)\[\[horsepower[^\|]{0,30}\|(hp|bhp|ihp|shp)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|$3}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(indicated(?:\s|-| |)horsepower)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ihp}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-| |)(hp|bhp|ihp|shp)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|$3|abbr=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+\|)horsepower\|", "$1horsepower|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+\|)hp\|", "$1hp|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+\|)bhp\|", "$1bhp|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+\|)ihp\|", "$1ihp|");
ArticleText=Regex.Replace(ArticleText, @"(?i)({convert\|\d+\|)shp\|", "$1shp|");
// rpm
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\s?rpm([:;,\.?!\s<][^\d\(\)\/\\])", "$1 rpm$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d) rpm([:;,\.?!\s<][^\d\(\)\/\\])", "$1 rpm$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\-rpm([:;,\.?!\s<][^\d\(\)\/\\])", "$1 rpm$2");
// decibel
ArticleText=Regex.Replace(ArticleText, @"(\d)\s?(dB)\b", "$1 $2");
// bits per second
ArticleText=Regex.Replace(ArticleText, @"(\d)\s?([KkMmGgTt])?(?:bps|bits\/s|b\/s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 $2bit/s$3");
ArticleText=Regex.Replace(ArticleText, @"(\d) ([KkMmGgTt])?(?:bps|bits\/s|b\/s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 $2bit/s$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)bits?\/sec([:;,\.?!\s<][^\d\(\)\/\\])", "bit/s$1");
// bytes per second
ArticleText=Regex.Replace(ArticleText, @"([KkMmGgTt])(?:Bps|bytes?\/s)([:;,\.?!\s<][^\d\(\)\/\\])", " $1byte/s$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)bytes?\/s([:;,\.?!\s<][^\d\(\)\/\\])", "byte/s$1");
// capitalization of prefix with bits and bytes
ArticleText=Regex.Replace(ArticleText, @"K(bit|B|byte)\/s", "k$1/s");
ArticleText=Regex.Replace(ArticleText, @"m(bit|B|byte)\/s", "M$1/s");
ArticleText=Regex.Replace(ArticleText, @"g(bit|B|byte)\/s", "G$1/s");
ArticleText=Regex.Replace(ArticleText, @"t(bit|B|byte)\/s", "T$1/s");
// space with bits and bytes
ArticleText=Regex.Replace(ArticleText, @"([^\w]\d)\s?(k|M|G|T)(bit|B)", "$1 $2$3");
//aviation specifications: unprotect 'main=' and 'alt='
ArticleText=Regex.Replace(ArticleText, @"(?i)((?:main|alt)\s?=\s?)xx(\d)", "$1$2");
//change format of convert template variables
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]+km):h", "$1/h");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]+mi):h", "$1/h");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]+ft):s", "$1/s");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]+m):s", "$1/s");
//change deprecated knot in template code
//ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|[^}]*knot)\|km\/h mph([^}]*}})", "$1$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(1.5)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (2.8 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(7)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (13 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?\|km\/h(?:\|\d|)(?:\|lk=on|)}}", "$1 knots (19 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?\|km\/h(?:\|-1|)(?:\|lk=on|)}}", "$1 knots (20 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(11)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (20 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(12)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (22 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(13)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (24 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(14)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (26 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(15)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (28 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (30 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(17)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (31 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(18)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (33 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (35 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19\.1)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (35.4 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(20)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (37 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(21)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (39 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(20\.8)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (38.5 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(21\.06)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (39.00 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(23)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (43 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(23\.4)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (43.3 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(25)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (46 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(27)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (50 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(27\.5)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (50.9 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(27\.9)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (51.7 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(28)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (52 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(29\.98)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (55.52 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(30)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (56 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(31)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (57 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(35\.5)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (65.7 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(39)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (72 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(40)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (74 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(50)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (93 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(60)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (110 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(70)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (130 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(80)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (150 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(90)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (170 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(100)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (190 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(110)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (200 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(120)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (220 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(130)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (240 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(140)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (260 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(9\.0)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (17 km/h/10 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (19 km/h/12 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(11)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (20 km/h/13 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(12)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (22 km/h/14 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(13)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (24 km/h/15 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(14)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (26 km/h/16 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(14\.1)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (26.1 km/h/16.2 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(15)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (28 km/h/17 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (30 km/h/18 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16\.8)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (31.1 km/h/19.3 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(17)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (31 km/h/20 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(18)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (33 km/h/21 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (35 km/h/22 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(20)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (37 km/h/23 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(21\.5)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (39.8 km/h/24.7 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(23)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (43 km/h/26 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(24)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (44 km/h/28 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(33\.8)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (62.6 km/h/38.9 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(39)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)}}", "$1 knots (72 km/h/45 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(24)\|km\/h\|kno?t?(?:\|\d|)(?:\|lk=on|)}}", "$1 km/h (13 kn)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?\|km\/h(?:\|\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (19 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?\|km\/h(?:\|-1\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (20 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(11)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (20 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(12)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (22 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(13)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (24 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(14)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (26 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(15)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (28 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (30 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(17)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (31 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(18)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (33 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (35 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19\.1)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (35.4 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19\.5)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (36.1 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(20)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (37 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(23)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (43 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(27\.5)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (50.9 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(28)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (52 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(30)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (56 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(39)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (72 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(40)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (74 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(50)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (93 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(60)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (110 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(70)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (130 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(80)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (150 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(90)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (170 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(100)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (190 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(110)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (200 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(120)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (220 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(130)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (240 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(140)\|kno?t?\|km\/h(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (260 km/h)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(9\.0)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (17 km/h/10 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(10)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (19 km/h/12 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(11)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (20 km/h/13 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(12)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (22 km/h/14 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(13)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (24 km/h/15 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(14)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (26 km/h/16 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(15)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (28 km/h/17 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (30 km/h/18 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(16\.8)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (31.1 km/h/19.3 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(17)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (31 km/h/20 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(18)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (33 km/h/21 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(19)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (35 km/h/22 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(20)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (37 km/h/23 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(23)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (43 km/h/26 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(24)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (44 km/h/28 mph)");
//ArticleText=Regex.Replace(ArticleText, @"(?i){{convert\|(39)\|kno?t?(?:\|-?\d|)(?:\|lk=on|)\|adj=on(?:\|lk=on|)}}", "$1 knot (72 km/h/45 mph)");
//ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]+\|kn)ot(\||})", "$1$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)({{convert\|[^}]*kn)ot([^}]*abbr=on}})", "$1$2");
//replace other templates with convert template
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi\sto\skm\|(\d{1,9})}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi\sto\skm\|(\d{1,9})\|round[^\}]{1,5}}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi2\sto\skm2\|(\d{1,9})}}", "{{convert|$1|mi|km}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{mi2\sto\skm2\|(\d{1,9})\|round[^\}]{1,5}}}", "{{convert|$1|mi|km}}");
//replace rail gauge template
ArticleText=Regex.Replace(ArticleText, @"(?i){{(\d?\d)\s?in}}", "{{convert|$1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{(\d?\d)\s?ft}}", "{{convert|$1|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{(\d?\d)\s?ft\s?(\d?\d)\s?in}}", "{{convert|$1|ft|$2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{(\d?\d)\s?ft\s?(\d?\d\.\d+)\s?in}}", "{{convert|$1|ft|$2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i)({{railgauge\|[^}]+)\|lk=on(}})", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|(\d?\d)\s?in}}", "{{convert|$1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|(\d?\d)\s?ft}}", "{{convert|$1|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|(\d?\d)\s?ft\s?(\d?\d)\s?in}}", "{{convert|$1|ft|$2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|(\d?\d)\s?ft\s?(\d?\d\.\d+)\s?in}}", "{{convert|$1|ft|$2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|24}}", "{{convert|2|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|25}}", "{{convert|2|ft|1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|26}}", "{{convert|2|ft|2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|27}}", "{{convert|2|ft|3|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|28}}", "{{convert|2|ft|4|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|29}}", "{{convert|2|ft|5|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|30}}", "{{convert|2|ft|6|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|31}}", "{{convert|2|ft|7|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|32}}", "{{convert|2|ft|8|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|33}}", "{{convert|2|ft|9|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|34}}", "{{convert|2|ft|10|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|35}}", "{{convert|2|ft|11|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|36}}", "{{convert|3|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|37}}", "{{convert|3|ft|1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|38}}", "{{convert|3|ft|2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|39}}", "{{convert|3|ft|3|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|40}}", "{{convert|3|ft|4|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|41}}", "{{convert|3|ft|5|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|42}}", "{{convert|3|ft|6|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|48}}", "{{convert|4|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|49}}", "{{convert|4|ft|1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|50}}", "{{convert|4|ft|2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|51}}", "{{convert|4|ft|3|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|52}}", "{{convert|4|ft|4|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|53}}", "{{convert|4|ft|5|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|54}}", "{{convert|4|ft|6|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|55}}", "{{convert|4|ft|7|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|56}}", "{{convert|4|ft|8|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|57}}", "{{convert|4|ft|9|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|58}}", "{{convert|4|ft|10|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|59}}", "{{convert|4|ft|11|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|60}}", "{{convert|5|ft|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|61}}", "{{convert|5|ft|1|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|62}}", "{{convert|5|ft|2|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|63}}", "{{convert|5|ft|3|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|64}}", "{{convert|5|ft|4|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|65}}", "{{convert|5|ft|5|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|66}}", "{{convert|5|ft|6|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|67}}", "{{convert|5|ft|7|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|68}}", "{{convert|5|ft|8|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|69}}", "{{convert|5|ft|9|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|70}}", "{{convert|5|ft|10|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|71}}", "{{convert|5|ft|11|in|mm|0|abbr=on}}");
ArticleText=Regex.Replace(ArticleText, @"(?i){{railgauge\|72}}", "{{convert|6|ft|mm|0|abbr=on}}");
//fix superscript after convert template
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)ft\|m([^}]*}})<sup>2<\/sup>", "$1sqft|m2$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)ft\|m([^}]*}})<sup>3<\/sup>", "$1cuft|m3$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)m\|ft([^}]*}})<sup>2<\/sup>", "$1m2|sqft$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)m\|ft([^}]*}})<sup>3<\/sup>", "$1m3|cuft$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)mi\|km([^}]*}})<sup>2<\/sup>", "$1sqmi|km2$2");
ArticleText=Regex.Replace(ArticleText, @"({{convert\|\d+\|)km\|mi([^}]*}})<sup>2<\/sup>", "$1km2|sqmi$2");
//remove commas from numerical values in convert template
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]*),", "$1");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]*),", "$1");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]*),", "$1");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]*),", "$1");
ArticleText=Regex.Replace(ArticleText, @"({convert\|[^}]*),", "$1");
//remove leading zeros from convert template
ArticleText=Regex.Replace(ArticleText, @"({convert\|)0(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"({convert\|)0(\d)", "$1$2");
ArticleText=Regex.Replace(ArticleText, @"({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\s?_?E\s?[\-\+]?\d{1,2}\s?..?\|([^\]]{1,50})\]\]", "$1");
ArticleText=Regex.Replace(ArticleText, @"(?i)\[\[Orders\sof\smagnitude\s\([^\)]+\)\|([^\]]{1,50})\]\]", "$1");
//Unprotect images, quotes etc (i.e. put them back)
return ht.AddBackMore(ArticleText);
//return ht.AddBack(ArticleText);
return ArticleText;
}
//