User:Lightmouse/AWB/scripts/add metric units

//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|-|&nbsp;|)°F([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|°F|°C|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(-?\d[\d,\.]*)(?:\s|-|&nbsp;|)(?:deg|degree|degrees)(?:\s|-|&nbsp;|)Fahrenheit([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|°F|°C}}$3");
// Convert &sup to superscript
ArticleText=Regex.Replace(ArticleText, @"&sup2;", "²");
ArticleText=Regex.Replace(ArticleText, @"&sup3;", "³");
//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,\.]*)&nbsp;(?:metres|meters|metre|meter)(\))", "$1&nbsp;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,\.]*)&nbsp;(?:m\/second|m\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;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|-|&nbsp;|)sq(?:\s|\.\s|-|&nbsp;)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,\.]*)&nbsp;\[\[(kilometres|kilometers|kilometre|kilometer)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;$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,\.]*)&nbsp;\[\[(?: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,\.]*)&nbsp;kms?([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;km$3");
ArticleText=Regex.Replace(ArticleText, @"({convert\|\d+\|(?:mi|km)[^\}]*)\|lk=(?:on|in|out)", "$1");
//square kilometre
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-|&nbsp;)\[\[km²\]\]", "$1$2km²");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)\s?sq\.?(?:\s|-|&nbsp;|)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,\.]*)&nbsp;(?:km\/second|km\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;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,\.]*)&nbsp;(?:km\/hr|km\/ph|kph|kmph|kmh)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;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,\.]*)&nbsp;\[\[(?:km\/hr|km\/ph|kph|kmph|kmh)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;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,\.]*)&nbsp;\[\[(kilograms?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;$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|-|&nbsp;|)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16})\+?(?:\s|-|&nbsp;|)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]\.\d*)\+?(?:\s|-|&nbsp;|)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+\.\d*)\+?(?:\s|-|&nbsp;|)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,])\+?(?:\s|-|&nbsp;|)(?:ct|carats|\[\[carat\s\(mass\)\|carat\]\]s)(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+)\+?(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]{5,16})\+?(?:\s|-|&nbsp;|)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|kg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]\.\d*)\+?(?:\s|-|&nbsp;|)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+\.\d*)\+?(?:\s|-|&nbsp;|)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|g}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,])\+?(?:\s|-|&nbsp;|)(?:ct|carat|\[\[carat\s\(mass\)\|carat\]\])(\W[^\(])", "$1{{convert|$2|carat|mg}}$3");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\W)([\d,]+)\+?(?:\s|-|&nbsp;|)(?: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,\.]*)&nbsp;(?:feet|foot)(\))", "$1&nbsp;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,\.]*)&nbsp;ft\.(\))", "$1&nbsp;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)&nbsp;sq\.?&nbsp;(feet|foot|ft)", "$1&nbsp;sq&nbsp;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)&nbsp;square&nbsp;ft", "$1&nbsp;sq&nbsp;ft");

//square foot: abbreviation
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)sq(?:\s|-|&nbsp;|)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)ft<sup>2<\/sup>([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|abbr=on}}$3");

ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)square(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)square(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)thousand(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)thousand(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)thousand(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|sqft|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2|abbr=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|sqft|m2|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)ft([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|sqft|m2|abbr=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|sqft|m2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:sq|square)\.?(?:\s|-|&nbsp;|)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|-|&nbsp;|)(?: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|-|&nbsp;|)(?: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,\.]*)&nbsp;(?:ft\/second|ft\/sec)([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;ft/s$3");
//feet per second:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)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|-|&nbsp;|)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|-|&nbsp;|)yds?([:;,\.?!\s<][^\d\(\)\/\\])", "$1 yd$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(?:\s|-|&nbsp;|)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|-|&nbsp;|)(?:yards|\[\[yard\]\]s|\[\[yards\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m}}$3");
//yards: singular
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?:yard|\[\[yard\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m|adj=on}}$3");
//yards: abbreviated
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)yd([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|yd|m|abbr=on}}$3");
//yards: in full
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sone(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (2 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (3 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (7 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (9 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seleven(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (10 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwelve(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthirteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (12 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfourteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfifteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (14 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssixteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (15 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseventeen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seighteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snineteen(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (17 m)$2");
//ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwenty(?:\s|-|&nbsp;|)yards?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (18 m)$2");
// knot
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-|&nbsp;)(?: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|-|&nbsp;|)miles\s(?:at|@)\s([\d\.]{1,9}(?:\s|-|&nbsp;|)knots|{{convert)", "$1 nautical miles at $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\d)(\s|-|&nbsp;)(?:mi|nm|nmi)\s(?:at|@)\s([\d\.]{1,9}(?:\s|-|&nbsp;|)knots|{{convert)", "$1$2nmi at $3");
//nautical mile: plural unlinked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)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|-|&nbsp;|)\[\[nautical(?:\s|-|&nbsp;|)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|-|&nbsp;|)\[\[nautical(?:\s|-|&nbsp;|)mile\]\]s([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km}}$3");
//nautical mile: singular unlinked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)mile([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km|adj=on}}$3");
//nautical mile: singular linked
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-|&nbsp;|)\[\[nautical(?:\s|-|&nbsp;|)mile\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|nmi|km|adj=on}}$3");
//nautical mile: abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,\.]+)\+?(?:\s|-|&nbsp;|)(?:\[\[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|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1.9 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (7 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (9 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (15 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (17 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seleven(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (20 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwelve(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (22 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthirteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfourteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (26 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfifteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (28 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssixteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (30 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseventeen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (31 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seighteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (33 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snineteen(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (35 km)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwenty(?:\s|-|&nbsp;|)nautical(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (37 km)$2");
//knot - plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)(?: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|-|&nbsp;|)(?: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,\.]*)&nbsp;\[\[(miles?)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1$2&nbsp;$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|-|&nbsp;|)(?:miles|\[\[miles\]\]|\[\[mile\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km}}$3");
//miles: singular
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?:mile|\[\[mile\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km|adj=on}}$3");
//miles: abbreviated
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)mi([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi|km|abbr=on}}$3");
//miles: in full
ArticleText=Regex.Replace(ArticleText, @"([^y]\sone(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (1.6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwo(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (3 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sthree(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (5 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfour(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (6 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfive(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\ssix(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (10 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sseven(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (11 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seight(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (13 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\snine(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (14 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sten(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seleven(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (18 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwelve(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sthirteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (19 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfourteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (21 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sfifteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sixteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (26 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\sseventeen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (27 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\seighteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (29 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\snineteen(?:\s|-|&nbsp;|)miles?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (30 km)$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\stwenty(?:\s|-|&nbsp;|)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|-|&nbsp;|)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|-|&nbsp;|)mph([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|mi/h|km/h|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)miles(?:\s|-|&nbsp;|)per(?:\s|-|&nbsp;|)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|-|&nbsp;|)(mile)", "$1uare $2");
// square mile:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)square(?:\s|-|&nbsp;|)miles([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2}}$3");
// square mile:singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)square(?:\s|-|&nbsp;|)mile([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2|adj=on}}$3");
// square mile:abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)sq(?:\s|-|&nbsp;|)mi([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|sqmi|km2|abbr=on}}$3");
//acre foot:plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-|&nbsp;|)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)\.(\d\d)(?:\s|-|&nbsp;|)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre feet}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d+)(?:\s|-|&nbsp;|)MAF([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000000|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)\[\[acre(?:\s|-|&nbsp;|)foot\|acre(?:\s|-|&nbsp;|)feet\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet}}$3");
//acre foot:singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre feet|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)acre(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)\[\[acre(?:\s|-|&nbsp;|)foot\|acre(?:\s|-|&nbsp;|)feet\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre feet|adj=on}}$3");
//acre foot:abbreviation
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?:acre|ac\.?)(?:\s|-|&nbsp;|)(?:foot|feet|ft)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre ft|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)\[\[acre(?:\s|-|&nbsp;|)foot\|acre(?:\s|-|&nbsp;|)ft\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre ft|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)\[\[acre(?:\s|-|&nbsp;|)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|-|&nbsp;|)(?:surface|square)(?:\s|-|&nbsp;|)acre", "$1 acre");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)thousand(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)thousand(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2,000|acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|e6acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|e6acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,00000|acre|km2}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)([\d,]+)\.(\d)(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)million(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2$3,0000|acre|km2|adj=on}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sone(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)(\sa(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (4,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\stwo(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (8,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sthree(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (12,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfour(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (16,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sfive(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (20,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\ssix(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (24,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sseven(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (28,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\seight(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (32,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\snine(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (36,000 km²)$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^y]\sten(?:\s|-|&nbsp;|)million(?:\s|-|&nbsp;|)acres?)([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (40,000 km²)$2");
//acre:plural
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)([\d,]+\d\d[\d\.]*)\+?(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|km2}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d?\d\.\d+|\d?\d)\+?(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|km2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d?\d\.\d+|\d?\d)\+?(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|acre|m2|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)one(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|1|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)two(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|2|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)three(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|3|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)four(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|4|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)five(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|5|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)six(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|6|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seven(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|7|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eight(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|8|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nine(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|9|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ten(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|10|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eleven(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|11|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twelve(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|12|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|13|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fourteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|14|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|15|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|16|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventeen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|17|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|18|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nineteen(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|19|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twenty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|20|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|30|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)forty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|40|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|50|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|60|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventy(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|70|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighty(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|80|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ninety(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|90|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^oexntr].)hundred(?:\s|-|&nbsp;|)(?:acre|\[\[acre\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|100|acre|m2|adj=on}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)one(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|1|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)two(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|2|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)three(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|3|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)four(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|4|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)five(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|5|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)six(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|6|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seven(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|7|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eight(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|8|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nine(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|9|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ten(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|10|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eleven(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|11|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twelve(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|12|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|13|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fourteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|14|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|15|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|16|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventeen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|17|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|18|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)nineteen(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|19|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)twenty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|20|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)thirty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|30|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)forty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|40|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)fifty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|50|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)sixty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|60|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)seventy(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|70|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)eighty(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|80|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^y]\W)ninety(?:\s|-|&nbsp;|)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|90|acre|m2}}$2");
ArticleText=Regex.Replace(ArticleText, @"([^oexntr].)hundred(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)pounds?(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)foot(?:\s|-|&nbsp;|)pounds([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)pound(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)foot(?:\s|-|&nbsp;|)pound([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft.lbf|N.m|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)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|-|&nbsp;|)pounds\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)pounds\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|N}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*000)(?:\s|-|&nbsp;|)pound\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)pound\sforce([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|N|adj=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*000)(?:\s|-|&nbsp;|)lbf([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|lbf|kN|abbr=on}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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)&nbsp;lbs?([:;,\.?!\s<][^\d\(\)\/\\])", "$1&nbsp;lb$2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)lb([:;,\.?!\s][^\d\(\)\/\\])", "$1{{convert|$2|lb|abbr=on}}$3");
//pounds and ounces - plural
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)pounds(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)pound(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)lbs?\.?,?(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)feet\.?(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)foot\.?(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)ft\.?(?:\s|-|&nbsp;|)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)linear(?:\s|-|&nbsp;|)feet([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m}}$3");
//foot: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)foot([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ft|m|adj=on}}$3");
//foot: abbreviated
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)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|-|&nbsp;|)inches([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|in|mm}}$3");
// inch: plural with number in words
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthree(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (76 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfour(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (102 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfive(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (127 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssix(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (152 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sseven(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (178 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seight(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (203 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\snine(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (229 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sten(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (254 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seleven(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (279 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\stwelve(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (305 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthirteen(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (330 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfourteen(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (356 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfifteen(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (381 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssixteen(?:\s|-|&nbsp;|)(?:inches|\[\[inches\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (406 mm) $2");
//inch: singular
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\Wt'’]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(?: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|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (76 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfour(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (102 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfive(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (127 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssix(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (152 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sseven(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (178 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seight(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (203 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\snine(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (229 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sten(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (254 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\seleven(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (279 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\stwelve(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (305 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sthirteen(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (330 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfourteen(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (356 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\sfifteen(?:\s|-|&nbsp;|)(?:inch|\[\[inch\]\]))([:;,\.?!\s<][^\d\(\)\/\\])", "$1 (381 mm) $2");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^ty]\ssixteen(?:\s|-|&nbsp;|)(?: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)&nbsp;(horsepower|hp|bhp|ihp|shp)([:;,\.?!\s<][^\d\(\)\/\\])", "$1&nbsp;$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|-|&nbsp;|)(?:horsepower|\[\[horsepower\]\])([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|hp}}$3");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)\[\[horsepower[^\|]{0,30}\|(hp|bhp|ihp|shp)\]\]([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|$3}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(indicated(?:\s|-|&nbsp;|)horsepower)([:;,\.?!\s<][^\d\(\)\/\\])", "$1{{convert|$2|ihp}}$4");
ArticleText=Regex.Replace(ArticleText, @"(?i)([^\d\(\)\/\\]\s)(\d[\d,\.]*)(?:\s|-|&nbsp;|)(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)&nbsp;rpm([:;,\.?!\s<][^\d\(\)\/\\])", "$1&nbsp;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)&nbsp;([KkMmGgTt])?(?:bps|bits\/s|b\/s)([:;,\.?!\s<][^\d\(\)\/\\])", "$1&nbsp;$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;
}
//