User:Dolenath/common.js

// User:Lupin/popups.js mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s'); //Create 'winc' function: function winc(s) { document.write(' '); } //'winc' function allows buttons to be added toolbar winc('User:Omegatron/monobook.js/addlink.js'); function dates { var txt = document.editform.wpTextbox1; //Identify surprise or 'Easter egg' diversions linking years to 'year in something' articles. Turn them into year links to be dealt with below txt.value=txt.value.replace(/\[\[\d{1,4}s?\sin\s[^\|]{1,30}\|(\d{1,4}s?)\]\]/gi, '\[\[$1\]\]'); // century txt.value=txt.value.replace(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty[ \-]first))[ \-]century\]\]/gi, '$1 century'); txt.value=txt.value.replace(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty[ \-]first))[ \-]century\s(AD|BC|CE|BCE)\]\]/gi, '$1 century'); txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))[ \-]century\]\]/gi, '$1 century'); txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]century\]\]/gi, '$1 century'); txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]centuries\]\]/gi, '$1 centuries'); txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))[ \-]century\s(AD|BC|CE|BCE)\]\]/gi, '$1 century $2'); txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]century\s(AD|BC|CE|BCE)\]\]/gi, '$1 century $2'); txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]centuries\s(AD|BC|CE|BCE)\]\]/gi, '$1 centuries $2'); //century but avoiding '20th Century Fox' txt.value=txt.value.replace(/(\d(?:st|nd|rd))[ \-]Century/gi, '$1 century'); txt.value=txt.value.replace(/([456789]th)[ \-]Century/gi, '$1 century'); txt.value=txt.value.replace(/(0th)[ \-]Century(.[^F])/gi, '$1 century$2'); // decades and years txt.value=txt.value.replace(/\[\[(\d{1,4})\'?s\]\]/gi, '$1s'); txt.value=txt.value.replace(/\[\[(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3'); txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\s?(?:AD|BC|CE|BCE)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2'); txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\s?(?:AD|BC|CE|BCE)\|(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3'); txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\|(\d{1,4})\'?(s)?\s?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3'); txt.value=txt.value.replace(/\[\[\d{1,4}\'?s?\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2'); txt.value=txt.value.replace(/\[\[\d\d?(?:st|nd|rd|th)\scentur(?:y|ies)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2'); txt.value=txt.value.replace(/\[\[\w{5,12}\scentur(?:y|ies)\|(\d{1,4})\'?(s)?\]\]/gi, '$1$2'); // solitary day_numbers txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1'); //month+day: remove incorrect trailing space txt.value=txt.value.replace(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?)\s(\]\])/gi,'$1$2'); //month+year //Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below txt.value=txt.value.replace(/\[\[\d{1,4}#[^\|]{1,30}\|((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]/gi, '\[\[$1\]\]'); txt.value=txt.value.replace(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]/gi, '$1'); //year: temporary change to protect accessyear. Undone below at #1 txt.value=txt.value.replace(/(accessyear\s?=\s?)\[\[(\d{1,4})\]\]/gi, '$1xx$2xx'); //Year: temporary change to protext preference dates - y?y?y?. Needed to handle 'year in' piped links txt.value=txt.value.replace(/(\[\[\d\d?\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx'); txt.value=txt.value.replace(/(\[\[\d\d?\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx'); txt.value=txt.value.replace(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx'); txt.value=txt.value.replace(/(\[\[(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d\d?\]\],?\s?\s?)\[\[(\d{1,4})\]\]y?y?y?/gi,'$1xx$2xx'); txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d\d?\]\])/gi,'xx$1xx$2'); txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d\d?\]\])/gi,'xx$1xx$2'); txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[\d\d?\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])/gi,'xx$1xx$2'); txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]y?y?y?(,?\s?\-?\s?\[\[\d\d\-\d\d\]\]y?y?y?)/gi,'xx$1xx$2'); //year: now remove unprotected linked years txt.value=txt.value.replace(/\[\[(\d{1,4})\]\]/gi, '$1'); //year: #1. Undo temporary change to protect accessyear and date preference dates txt.value=txt.value.replace(/xx(\d{1,4})xx/gi, '\[\[$1\]\]'); } function formatgeneral { var txt = document.editform.wpTextbox1; //remove flagicons from birth and death txt.value=txt.value.replace(/(birth\s?=\s?)\{\{flagicon\|[^\}]{1,30}\}\}/gi, '$1'); txt.value=txt.value.replace(/(death\s?=\s?)\{\{flagicon\|[^\}]{1,30}\}\}/gi, '$1'); txt.value=txt.value.replace(/(birth_place\s?=\s?)\{\{flagicon\|[^\}]{1,30}\}\}/gi, '$1'); txt.value=txt.value.replace(/(death_place\s?=\s?)\{\{flagicon\|[^\}]{1,30}\}\}/gi, '$1'); //fix captalisation in headings txt.value=txt.value.replace(/\n(={2,3})(\s?)See\sAlso\s?={2,3}/g, '\n$1$2See also$2$1') txt.value=txt.value.replace(/\n(={2,3})(\s?)Further\sReading\s?={2,3}/g, '\n$1$2Further reading$2$1') txt.value=txt.value.replace(/\n(={2,3})(\s?)Works\sCited\s?={2,3}/g, '\n$1$2Works cited$2$1') txt.value=txt.value.replace(/\n(={2,3})(\s?)External\slink(s?)\s?={2,3}/g, '\n$1$2External link$3$2$1') txt.value=txt.value.replace(/\n(={2,3})(\s?)Foot\s[Nn]otes\s?={2,3}/g, '\n$1$2Footnotes$2$1') //symbol for 'times' txt.value=txt.value.replace(/&times;/gi, '×'); //symbol for superscript 2 and 3 txt.value=txt.value.replace(/ 2<\/sup>/gi, '²'); txt.value=txt.value.replace(/ 3<\/sup>/gi, '³'); //Attempt to deal with naval infobox txt.value=txt.value.replace(/General\sCharacteristics/g, 'General characteristics'); //turn letter 'x' into symbol '×' txt.value=txt.value.replace(/(\d)\sx\s(\d{1,3})\sin\s\(/gi, '$1 × $2 in ('); txt.value=txt.value.replace(/(\d)\sx\s(\d{1,3})\sinch\s/gi, '$1 × $2 inch '); //expand torpedo tube abbreviation txt.value=txt.value.replace(/inch\st\.?t\.?/g, 'inch torpedo tubes'); // inch guns and torpedos to mm txt.value=txt.value.replace(/\s(\d{1,3}\.?\d?)(?:\s|-| )inch(?:\s|-| )gun/gi, ' \{\{convert|$1|in|mm|sing=on\}\} gun'); txt.value=txt.value.replace(/\s(\d{1,3}\.?\d?)(?:\s|-| )inch(?:\s|-| )main\sgun/gi, ' \{\{convert|$1|in|mm|sing=on\}\} main gun'); txt.value=txt.value.replace(/\s(\d{1,3}\.?\d?)(?:\s|-| )inch(?:\s|-| )deck\sgun/gi, ' \{\{convert|$1|in|mm|sing=on\}\} deck gun'); txt.value=txt.value.replace(/\s(\d\d)(?:\s|-| )inch(?:\s|-| )torpedo/gi, ' \{\{convert|$1|in|mm|sing=on\}\} torpedo'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (76 mm) gun'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (102 mm) gun'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (127 mm) gun'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (152 mm) gun'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (178 mm) gun'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (203 mm) gun'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (229 mm) gun'); txt.value=txt.value.replace(/(\sten(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (254 mm) gun'); txt.value=txt.value.replace(/(\seleven(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (279 mm) gun'); txt.value=txt.value.replace(/(\stwelve(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (305 mm) gun'); txt.value=txt.value.replace(/(\sthirteen(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (330 mm) gun'); txt.value=txt.value.replace(/(\sfourteen(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (356 mm) gun'); txt.value=txt.value.replace(/(\sfifteen(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (381 mm) gun'); txt.value=txt.value.replace(/(\ssixteen(?:\s|-| )inch)(?:\s|-| )gun/gi, '$1 (406 mm) gun'); // Convert degree symbols into ° symbol, ensure preceding space txt.value=txt.value.replace(/&deg;/g, '°'); txt.value=txt.value.replace(/º/g, '°'); // Celsius spelling errors txt.value=txt.value.replace(/celsius/gi, 'Celsius'); txt.value=txt.value.replace(/celcius/gi, 'Celsius'); //Fix common naming error (be careful with this one) txt.value=txt.value.replace(/centigrade/gi, 'Celsius'); //Celsius or Fahrenheit txt.value=txt.value.replace(/°\s([CF])/g, '°$1'); txt.value=txt.value.replace(/° ([CF])/g, '°$1'); txt.value=txt.value.replace(/°\s?(celsius)/gi, '°C'); txt.value=txt.value.replace(/° (celsius)/gi, '°C'); txt.value=txt.value.replace(/(\d)\s?(°[CF])/g, '$1 $2'); txt.value=txt.value.replace(/deg[^\(]([CF])/gi, '°$1'); txt.value=txt.value.replace(/deg\s?([CF])/gi, '°$1'); txt.value=txt.value.replace(/deg ([CF])/gi, '°$1'); txt.value=txt.value.replace(/deg\.?\s?([CF])/gi, '°$1'); txt.value=txt.value.replace(/degrees?\s([CF])(\W)/gi, '°$1$2'); txt.value=txt.value.replace(/degrees? ([CF])(\W)/gi, '°$1$2'); txt.value=txt.value.replace(/(\d)\s?° ([CF])/g, '$1 °$2'); txt.value=txt.value.replace(/(\d)°([CF])/g, '$1 °$2'); txt.value=txt.value.replace(/(\d)°\[\[/g, '$1 °[['); txt.value=txt.value.replace(/(\d)° (\[\[[CF])/gi, '$1 °$2'); txt.value=txt.value.replace(/(\d)(\[\[Celsius|°C\]\])/gi, '$1 $2'); txt.value=txt.value.replace(/(\d)(\[\[Fahrenheit|°F\]\])/gi, '$1 $2'); txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(-?\d[\d,\.]{0,16})(?:\s|-| |)°?F([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1\{\{convert|$2|°F|°C|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(-?\d[\d,\.]{0,16})(?:\s|-| |)(?:deg|degree|degrees)(?:\s|-| |)Fahrenheit([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1\{\{convert|$2|°F|°C\}\}$3'); txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(-?\d[\d,\.]{0,16})(?:\s|-| |)°?C([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1\{\{convert|$2|°C|°F|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(-?\d[\d,\.]{0,16})(?:\s|-| |)(?:deg|degree|degrees)(?:\s|-| |)Celsius([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1\{\{convert|$2|°C|°F\}\}$3'); txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(-?\d[\d,\.]{0,16})(?:\s|-| |)(?:deg|degree|degrees)(?:\s|-| |)Centigrade([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1\{\{convert|$2|°C|°F\}\}$3');    // Convert &sup to superscript txt.value=txt.value.replace(/&sup2;/g, '²'); txt.value=txt.value.replace(/&sup3;/g, '³');    // Convert micro symbol to actual micro symbol, make sure it's spaced txt.value=txt.value.replace(/(\d)\s?(&mu;|μ|&micro;)(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat|M)(\W)/g, '$1 µ$3$4');    //metre    //space before 'm' only when lower case txt.value=txt.value.replace(/\[\[(metre)\]\]/gi, '$1'); txt.value=txt.value.replace(/([^£$]{9}\d)\s?m(\s)/g, '$1 m$2'); txt.value=txt.value.replace(/([^£$]{9}\d)\-m(\s)/g, '$1 m$2'); txt.value=txt.value.replace(/(\d)\s?sq\.?\s?m(\s)/gi, '$1 m²$2'); txt.value=txt.value.replace(/(\d)\-?sq\-?m(\s)/gi, '$1 m²$2'); txt.value=txt.value.replace(/m²\.\)/gi, 'm²)'); txt.value=txt.value.replace(/\smetres?\)/gi, ' m)'); txt.value=txt.value.replace(/\smeters?\)/gi, ' m)'); txt.value=txt.value.replace(/([\|\=\>][\s\d\.]{1,9})meters?(\s{1,3}\/gi, '$1m$2'); txt.value=txt.value.replace(/([\|\=\>][\s\d\.]{1,9})metres?(\s{1,3}\/gi, '$1m$2'); txt.value=txt.value.replace(/([\|\=\>][\s\d\.]{1,9} )meters?(( |\s{1,3})\/gi, '$1m$2'); txt.value=txt.value.replace(/([\|\=\>][\s\d\.]{1,9} )metres?(( |\s{1,3})\/gi, '$1m$2'); //metres: plural (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|\}\}$6'); //metres: singular (British Imperial spelling) txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|m|ft|sing=on\}\}$6'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )metre(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|m|ft|sing=on\}\}$6'); //metres: abbreviated txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )m(\.|\,|\s[^\(\/]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|abbr=on\}\}$6'); //metres: in full (British Imperial spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )metre?)(\s[^\(\)]{2})/gi, '$1 (3.2 ft)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (6.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (10 ft)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (13 ft)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (16.4 ft)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (19.7 ft)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (23 ft)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (26.2 ft)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (29.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (32.8 ft)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (36 ft)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (39 ft)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (42.6 ft)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (46 ft)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (49 ft)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (52.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (56 ft)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (59 ft)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (62 ft)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )metres?)(\s[^\(\)]{2})/gi, '$1 (65.6 ft)$2'); //meters: plural (American spelling) txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m|ft|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|spell=us\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|m|ft|spell=us\}\}$6'); //meters: singular (American spelling) txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|m|ft|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|m|ft|sing=on|spell=us\}\}$6'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )meter(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|m|ft|sing=on|spell=us\}\}$6'); //meters: in full (American spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )meter?)(\s[^\(\)]{2})/gi, '$1 (3.2 ft)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (6.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (10 ft)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (13 ft)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (16.4 ft)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (19.7 ft)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (23 ft)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (26.2 ft)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (29.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (32.8 ft)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (36 ft)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (39 ft)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (42.6 ft)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (46 ft)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (49 ft)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (52.5 ft)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (56 ft)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (59 ft)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (62 ft)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )meters?)(\s[^\(\)]{2})/gi, '$1 (65.6 ft)$2'); //metres per second //metres per second:plural  (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )metres\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|\}\}$5'); //metres per second:singular  (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|sing=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )metre\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|sing=on\}\}$5'); //metres per second:abbreviated  (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )m\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|abbr=on\}\}$5'); //meters per second:plural  (American spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )meters\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|spell=us\}\}$5'); //meters per second:singular  (American spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|m/s|ft/s|sing=on|spell=us\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )meter\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m/s|ft/s|sing=on|spell=us\}\}$5');    // millimetre txt.value=txt.value.replace(/(\d)\s?mm(\W)/g, '$1 mm$2'); txt.value=txt.value.replace(/(\d)\-mm(\W)/g, '$1 mm$2');    // kilometre txt.value=txt.value.replace(/\[\[(kilometre|kilometer)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)\s?kms?(\W)/gi, '$1 km$2'); txt.value=txt.value.replace(/(\d)\-kms?(\W)/gi, '$1 km$2'); txt.value=txt.value.replace(/(\d) kms?(\W)/gi, '$1 km$2');    //kilometre (British Imperial spelling) txt.value=txt.value.replace(/\[\[(kilometre)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(kilometre)/gi, '$1 $2'); //kilometres: plural (British Imperial spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|km|mi|\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )kilometres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|km|mi|\}\}$6'); //kilometres: singular (British Imperial spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|sing=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )kilometre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|sing=on\}\}$6'); //kilometres: abbreviated txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )km(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|abbr=on\}\}$6'); //kilometres: in full (British Imperial spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (0.6 mi)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (1.25 mi)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (2 mi)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (2.5 mi)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (3.1 mi)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (3.75 mi)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (4.4 mi)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (5 mi)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (5.6 mi)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (6.2 mi)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (6.8 mi)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (7.5 mi)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (8.1 mi)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (8.7 mi)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (9.3 mi)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (10 mi)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (10.6 mi)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (11.2 mi)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (11.8 mi)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )kilometres?)(\s[^p\(\)]{2})/gi, '$1 (12.4 mi)$2');    //kilometer (American spelling) txt.value=txt.value.replace(/\[\[(kilometer)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(kilometer)/gi, '$1 $2'); //kilometers: plural (American spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|km|mi|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|km|mi|spell=us\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )kilometers([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|km|mi|spell=us\}\}$6'); //kilometers: singular (American spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|km|mi|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|sing=on|spell=us\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )kilometer([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|km|mi|sing=on|spell=us\}\}$6'); //kilometers: in full (American spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (0.6 mi)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (1.25 mi)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (2 mi)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (2.5 mi)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (3.1 mi)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (3.75 mi)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (4.4 mi)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (5 mi)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (5.6 mi)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (6.2 mi)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (6.8 mi)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (7.5 mi)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (8.1 mi)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (8.7 mi)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (9.3 mi)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (10 mi)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (10.6 mi)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (11.2 mi)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (11.8 mi)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )kilometers?)(\s[^p\(\)]{2})/gi, '$1 (12.4 mi)$2');    // centimetre txt.value=txt.value.replace(/\[\[(centimetre|centimeter)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)\s?cms?(\W)/gi, '$1 cm$2'); txt.value=txt.value.replace(/(\d)\-cms?(\W)/gi, '$1 cm$2'); txt.value=txt.value.replace(/(\d) cms?(\W)/gi, '$1 cm$2');    //centimetre (British Imperial spelling) txt.value=txt.value.replace(/\[\[(centimetre)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(centimetre)/gi, '$1 $2'); //centimetres: plural (British Imperial spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|cm|in|\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )centimetres([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|cm|in|\}\}$6'); //centimetres: singular (British Imperial spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|sing=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )centimetre([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|sing=on\}\}$6'); //centimetres: abbreviated txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )cm(\.|\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|abbr=on\}\}$6'); //centimetres: in full (British Imperial spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (0.4 in)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (0.8 in)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (1.2 in)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (1.6 in)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (2.0 in)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (2.4 in)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (2.75 in)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (3.2 in)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (3.5 in)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (4 in)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (4.3 in)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (4.7 in)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (5.1 in)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (5.5 in)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (5.9 in)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (6.3 in)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (6.7 in)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (7.1 in)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (7.5 in)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )centimetres?)(\s[^p\(\)]{2})/gi, '$1 (7.9 in)$2');    //centimeter (American spelling) txt.value=txt.value.replace(/\[\[(centimeter)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(centimeter)/gi, '$1 $2'); //centimeters: plural (American spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|cm|in|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|cm|in|spell=us\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )centimeters([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|cm|in|spell=us\}\}$6'); //centimeters: singular (American spelling) txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|cm|in|sing=on|spell=us\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|sing=on|spell=us\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )centimeter([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|cm|in|sing=on|spell=us\}\}$6'); //centimeters: in full (American spelling) txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (0.4 in)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (0.8 in)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (1.2 in)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (1.6 in)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (2.0 in)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (2.4 in)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (2.75 in)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (3.2 in)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (3.5 in)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (4 in)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (4.3 in)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (4.7 in)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (5.1 in)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (5.5 in)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (5.9 in)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (6.3 in)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (6.7 in)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (7.1 in)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (7.5 in)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )centimeters?)(\s[^p\(\)]{2})/gi, '$1 (7.9 in)$2');    //square kilometre txt.value=txt.value.replace(/\[\[(square\skilometre)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)\s?sq\.?\s?kms?/gi, '$1 km²'); txt.value=txt.value.replace(/([^\|])sq\.?\s?kms?/gi, '$1km²'); txt.value=txt.value.replace(/sq kms?/gi, 'km²'); // square kilometre:plural (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{4})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )kilometres([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|\}\}$6'); // square kilometre:singular (British Imperial spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )kilometres?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|\}\}$6'); // square kilometer:plural (American spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{4})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|spell=us\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )kilometers([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|spell=us\}\}$6'); // square kilometer:singular (American spelling) txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|spell=us\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|spell=us\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )kilometers?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|spell=us\}\}$6'); // square kilometre:abbreviated sq km txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|abbr=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )sq(?:\s|-| )km([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|abbr=on\}\}$6'); // square kilometre:abbreviated km² txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|km2|sqmi|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|abbr=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )km²(\.|\,|\s[^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|km2|sqmi|abbr=on\}\}$6');    // kilometre per hour txt.value=txt.value.replace(/km\/hr(\W)/gi, 'km/h$1'); txt.value=txt.value.replace(/kph(\W)/gi, 'km/h$1'); txt.value=txt.value.replace(/kmph(\W)/gi, 'km/h$1'); txt.value=txt.value.replace(/(\d)\s?kmh/gi, '$1 km/h'); txt.value=txt.value.replace(/(\d) kmh/gi, '$1 km/h'); txt.value=txt.value.replace(/\[\[kmh\]\]/gi, '\[\[km/h\]\]'); txt.value=txt.value.replace(/km\/h/gi, 'km/h'); txt.value=txt.value.replace(/(\d)\s?km\/h/gi, '$1 km/h'); txt.value=txt.value.replace(/(\d)\-km\/h/gi, '$1 km/h'); txt.value=txt.value.replace(/(\d) km\/h/gi, '$1 km/h'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}00),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}0),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}),?(000)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2$3|km/h|mph|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2|km/h|mph|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )km\/h([^\(\)]{3})/gi, '$1\{\{convert|$2|km/h|mph|abbr=on\}\}$3');    // cubic centimetre txt.value=txt.value.replace(/(\d)\s?cm(\s)/gi, '$1 cm$2'); txt.value=txt.value.replace(/(\d)\s?cc(\s)/g, '$1 cc$2'); txt.value=txt.value.replace(/(\d)\-cc(\s)/g, '$1 cc$2');    // millilitre txt.value=txt.value.replace(/(\d)\s?ml(\W)/g, '$1 mL$2'); txt.value=txt.value.replace(/(\d)\-ml(\W)/g, '$1 mL$2');    // second txt.value=txt.value.replace(/\[\[(s)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(seconds?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[seconds?\|([^\]]{1,30})\]\]/gi, '$1');    //txt.value=txt.value.replace(/\/sec(\W)/gi, '/s$1');    //txt.value=txt.value.replace(/\/sec\)/gi, '/s)$1'); txt.value=txt.value.replace(/(\d)\s?ft\/second/gi, '$1 ft/s'); txt.value=txt.value.replace(/(\d)\s?ft\/sec(\W)/gi, '$1 ft/s$2'); txt.value=txt.value.replace(/(\d) ft\/sec(\W)/gi, '$1 ft/s$2'); txt.value=txt.value.replace(/(\d)\s?m\/second/gi, '$1 m/s'); txt.value=txt.value.replace(/(\d)\s?m\/sec(\W)/gi, '$1 m/s$2'); txt.value=txt.value.replace(/(\d)\ m\/sec(\W)/gi, '$1 m/s$2'); txt.value=txt.value.replace(/(\d)\s?km\/sec(\W)/gi, '$1 km/s$2'); txt.value=txt.value.replace(/frames\/s(\W)/gi, 'frame/s$1');    //minute txt.value=txt.value.replace(/\[\[(min)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(minutes?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[minutes?\|([^\]]{1,30})\]\]/gi, '$1'); // hour txt.value=txt.value.replace(/\[\[(h)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(hours?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[hours?\|([^\]]{1,30})\]\]/gi, '$1'); //day txt.value=txt.value.replace(/\[\[(d)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(days?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[days?\|([^\]]{1,30})\]\]/gi, '$1'); // kilogram txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )kilogrammes([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )kilogrammes([^\(\)]{2})/gi, '$1\{\{convert|$2\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )kilogrammes([^\(\)]{2})/gi, '$1\{\{convert|$2\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )kilogrammes([^\(\)]{2})/gi, '$1\{\{convert|$2\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )kilogrammes([^\(\)]{2})/gi, '$1\{\{convert||$2\}\}$3'); txt.value=txt.value.replace(/kilogramme/gi, 'kilogram'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )kilogramme([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )kilogramme([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )kilogramme([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\} $3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )kilogramme([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )kilogramme([^\(\)]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )s?kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )s?kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )s?kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )s?kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )s?kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )-kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )-kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )-kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )-kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )-kg([^\(\)\/]{2})/gi, '$1\{\{convert|$2|kg|lb|abbr=on\}\}$3'); txt.value=txt.value.replace(/\[\[(kilograms?)\]\]/gi, '$1'); //grams to ounces txt.value=txt.value.replace(/(\W)grammes(\W)/gi, '$1grams$2'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )grammes([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )grammes([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )grammes([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )grammes([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )grammes([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )grams([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )grams([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )grams([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )grams([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )grams([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )gram([^\(\)]{2})/gi, '$1\{\{Convert|$2|g|oz|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )gram([^\(\)]{2})/gi, '$1\{\{Convert|$2|g|oz|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )gram([^\(\)]{2})/gi, '$1\{\{Convert|$2|g|oz|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )gram([^\(\)]{2})/gi, '$1\{\{Convert|$2|g|oz|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )gram([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )g(\W\s[^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )g(\W\s[^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )g(\W\s[^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )g(\W\s[^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )g(\W\s[^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )gramme([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )gramme([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )gramme([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )gramme([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )gramme([^\(\)]{2})/gi, '$1\{\{convert|$2|g|oz|abbr=on\}\}$3'); txt.value=txt.value.replace(/(\W)gramme(\W)/gi, '$1gram$2'); // newton metre txt.value=txt.value.replace(/(\d)\s?(Nm\W)/gi, '$1 $2'); txt.value=txt.value.replace(/(\d)\-(Nm\W)/gi, '$1 $2'); // kilowatt txt.value=txt.value.replace(/(\d)\s?kW(\W)/gi, '$1 kW$2'); txt.value=txt.value.replace(/(\d)\-kW(\W)/gi, '$1 kW$2'); // Hertz txt.value=txt.value.replace(/(\d)\s?(G|M|k)?hz/gi, '$1 $2Hz'); txt.value=txt.value.replace(/(\d)\-(G|M|k)?hz/gi, '$1 $2Hz'); txt.value=txt.value.replace(/khz/gi, 'kHz'); // ohm txt.value=txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?\s?(&Omega;|ohm|Ohm)s?(\W)/g, '$1 $2Ω$4'); //grains to grams txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )grains([^\(\)]{2})/gi, '$1\{\{convert|$2|gr|g\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )grains([^\(\)]{2})/gi, '$1\{\{convert|$2|gr|g\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )grains([^\(\)]{2})/gi, '$1\{\{convert |$2|gr|g\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )grains([^\(\)]{2})/gi, '$1\{\{convert |$2|gr|g\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )grains([^\(\)]{2})/gi, '$1\{\{convert |$2|gr|g\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}00)(?:\s|-| )grain([^\(\)]{2})/gi, '$1\{\{Convert|$2|gr|g|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)(?:\s|-| )grain([^\(\)]{2})/gi, '$1\{\{Convert|$2|gr|g|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3})(?:\s|-| )grain([^\(\)]{2})/gi, '$1\{\{Convert|$2|gr|g|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d)(?:\s|-| )grain([^\(\)]{2})/gi, '$1\{\{Convert|$2|gr|g|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}\.\d\d)(?:\s|-| )grain([^\(\)]{2})/gi, '$1\{\{Convert|$2|gr|g|sing=on\}\}$3'); // pound weight txt.value=txt.value.replace(/\[\[\pound\s\(weight\)\|([^\]]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\|lbs?\.\]\]/gi, '|lb]]'); txt.value=txt.value.replace(/(\d)\s?lbs?/gi, '$1 lb'); txt.value=txt.value.replace(/(\d\+?)\s?lbs?/gi, '$1 lb'); txt.value=txt.value.replace(/(\d) lbs?/gi, '$1 lb'); //foot txt.value=txt.value.replace(/(\d)\s?ft(\W)/gi, '$1 ft$2'); txt.value=txt.value.replace(/(\d)\-ft(\W)/gi, '$1 ft$2'); txt.value=txt.value.replace(/(\W)ft\.\)/gi, '$1ft)'); txt.value=txt.value.replace(/\sfeet\)/gi, ' ft)'); txt.value=txt.value.replace(/\sfoot\)/gi, ' ft)'); txt.value=txt.value.replace(/ feet\)/gi, ' ft)'); txt.value=txt.value.replace(/(\|[\s\d\.]{1,9})feet(\s{1,3}\/gi, '$1ft$2'); // square metre   //txt.value=txt.value.replace(/([^\|])sq\.?\s?m/gi, '$1 m²'); txt.value=txt.value.replace(/(\d)(?:\s|-| )?(sq|square)\.?(?:\s|-| )?(metres|meters|metre|meter)/gi, '$1 $2 $3'); txt.value=txt.value.replace(/(\d)(?:\s|-| )? sq\.?(?:\s|-| )?(metres|meters|metre|meter)/gi, '$1 m²');   //txt.value=txt.value.replace(/sq m/gi, 'm²'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3}),?(000),?(000)(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|-5 abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )meter ([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us \}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )m²(\.|\,|\s[^\(]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us \}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us \}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )m²([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})\ssq\sm([^i\(\)]{2})/gi, '$1\{\{convert|$2|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )metres ([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sp=us \}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|m2|sqft|sing=on|sp=us\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d00)(?:\s|-| )thousand(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d0)(?:\s|-| )thousand(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d)(?:\s|-| )thousand(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )m(\W[^\(\)])/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d00)(?:\s|-| )million(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d0)(?:\s|-| )million(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d)(?:\s|-| )million(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.\E])(\d{1,3)(?:\s|-| )million(?:\s|-| )m²(\.|\,|\s[^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metres([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meters([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )metre([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on|sp=us\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )meter([^\(\)]{2})/gi, '$1\{\{convert|$2000000|m2|sqft|sing=on|sp=us\}\}$3'); // square foot //txt.value=txt.value.replace(/([^\|])sq\.?\s?ft/gi, '$1sq ft'); txt.value=txt.value.replace(/(\d)(?:\s|-| )?(sq|square)\.?(?:\s|-| )?(ft|feet|foot)/gi, '$1 $2 $3'); txt.value=txt.value.replace(/(\d) sq (ft|feet|foot)/gi, '$1 sq ft'); txt.value=txt.value.replace(/ft²/gi, 'sq ft'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(000)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(000)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(000)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3}),?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|sqft|m2|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )thousand(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )sq(?:\s|-| )ft([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )feet([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d00)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d0)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|sing=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3)(?:\s|-| )million(?:\s|-| )square(?:\s|-| )foot([^\(\)]{2})/gi, '$1\{\{convert|$2000000|sqft|m2|sing=on\}\}$3'); //feet per second //feet per second:plural txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )feet\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|\}\}$5'); //feet per second:singular txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|sing=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )foot\sper\ssecond([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|sing=on\}\}$5'); //feet per second:abbreviated txt.value=txt.value.replace(/(\s)(\d{1,3}00)?,?(000)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}0)?,?(000)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3|ft/s|m/s|abbr=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )ft\/s([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft/s|m/s|abbr=on\}\}$5'); // foot and inch txt.value=txt.value.replace(/(ength[.]{1,3})(\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]/gi, '$1$2 ft $3 in'); txt.value=txt.value.replace(/(idth[.]{1,3})(\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]/gi, '$1$2 ft $3 in'); txt.value=txt.value.replace(/([\(\|:]\s?\d{1,4})\s?['’]\s?(\d{1,3})\s?["”]([^NESW])/g, '$1 ft $2 in$3'); txt.value=txt.value.replace(/(\d)\s?ft\s?(\d{1,3})\s?in/gi, '$1 ft $2 in');   // yard txt.value=txt.value.replace(/(\d)\s?yds(\W)/gi, '$1 yd$2'); txt.value=txt.value.replace(/(\d) yds(\W)/gi, '$1 yd$2'); txt.value=txt.value.replace(/sq\.?\s?yds?/gi, 'sq yd'); txt.value=txt.value.replace(/yd\.\)/gi, 'yd)'); //yards: plural txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|yd|m|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|yd|m|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )yards([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|yd|m|\}\}$6'); //yards: singular txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|yd|m|sing=on\}\}$6'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )yard(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|yd|m|sing=on\}\}$6'); //yards: abbreviated txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|yd|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|yd|m|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )yd(\,|\s[^\(\/])/gi, '$1\{\{convert|$2$3$4$5|yd|m|abbr=on\}\}$6'); //yards: in full txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (1 m)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (2 m)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (3 m)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (4 m)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (5 m)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (5 m)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (6 m)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (7 m)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (8 m)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (9 m)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (10 m)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (11 m)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (12 m)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (13 m)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (14 m)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (15 m)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (16 m)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (16 m)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (17 m)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )yards?)(\s[^\(\)]{2})/gi, '$1 (18 m)$2'); // knot txt.value=txt.value.replace(/(\d)(\s|-| )kts(\W)/gi, '$1$2knots$3'); txt.value=txt.value.replace(/(\d)(\s|-| )kt(\W)/gi, '$1$2knots$3'); txt.value=txt.value.replace(/(\d)(\s|-| )knt(\W)/gi, '$1$2knots$3'); //nautical mile txt.value=txt.value.replace(/(\d)(?:\s|-| )miles\s\at\s(\d\d?(?:\s|-| )knots|\{\{convert\|[\d\.]{1,9}\|kn)/gi, '$1 nautical miles at $2'); txt.value=txt.value.replace(/(\d)(?:\s|-| )mi\s\at\s(\d\d?(?:\s|-| )knots|\{\{convert\|[\d\.]{1,9}\|kn)/gi, '$1 nmi at $2 knots'); txt.value=txt.value.replace(/(\d)(?:\s|-| )nm\s\at\s(\d\d?(?:\s|-| )knots|\{\{convert\|[\d\.]{1,9}\|kn)/gi, '$1 nmi at $2 knots'); //nautical mile: plural txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(000),?(000)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4|nmi|km mi|\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|\}\}$6'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )nautical(?:\s|-| )miles([^\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|\}\}$6'); //nautical mile: singular txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(000),?(000)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|sing=on\}\}$6'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )nautical(?:\s|-| )mile([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|sing=on\}\}$6'); //nautical mile: abbreviated txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(000),?(000)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|nmi|km mi|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )nmi(\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|nmi|km mi|abbr=on\}\}$6'); //nautical mile: in full txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (1.9 km)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (4 km)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (6 km)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (7 km)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (9 km)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (11 km)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (13 km)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (15 km)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (17 km)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (19 km)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (20 km)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (22 km)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (24 km)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (26 km)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (28 km)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (30 km)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (31 km)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (33 km)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (35 km)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )nautical(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (37 km)$2'); //knot - plural txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )knots([^\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )knots([^\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})(?:\s|-| )knots([^\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )knots([^\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|kn|km/h mph|\}\}$5'); //knot - singular txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )knot([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|sing=on\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )knot([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|sing=on\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})(?:\s|-| )knot([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3|kn|km/h mph|sing=on\}\}$4'); txt.value=txt.value.replace(/([^\d\(\)][^\d\(\)])(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )knot([^s\(\)][^\(\)])/gi, '$1\{\{convert|$2$3$4|kn|km/h mph|sing=on\}\}$5'); //mile txt.value=txt.value.replace(/\[\[(mile)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(mile)/gi, '$1 $2'); //miles: plural txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4|mi|km|\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|mi|km|\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )miles([^p\(\)]{2})/gi, '$1\{\{convert|$2$3$4$5|mi|km|\}\}$6'); //miles: singular txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|sing=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|mi|km|sing=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )mile([^s\(\)][^p\(\)])/gi, '$1\{\{convert|$2$3$4$5|mi|km|sing=on\}\}$6'); //miles: abbreviated txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(000),?(000)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4|mi|km|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|mi|km|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^r\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )mi(\,|\s[^\(\)])/gi, '$1\{\{convert|$2$3$4$5|mi|km|abbr=on\}\}$6'); //miles: in full txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (1.6 km)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (3 km)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (5 km)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (6 km)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (8 km)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (10 km)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (11 km)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (13 km)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (14 km)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (16 km)$2'); txt.value=txt.value.replace(/([^y]\seleven(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (18 km)$2'); txt.value=txt.value.replace(/([^y]\stwelve(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (19 km)$2'); txt.value=txt.value.replace(/([^y]\sthirteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (19 km)$2'); txt.value=txt.value.replace(/([^y]\sfourteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (21 km)$2'); txt.value=txt.value.replace(/([^y]\sfifteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (24 km)$2'); txt.value=txt.value.replace(/([^y]\ssixteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (26 km)$2'); txt.value=txt.value.replace(/([^y]\sseventeen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (27 km)$2'); txt.value=txt.value.replace(/([^y]\seighteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (29 km)$2'); txt.value=txt.value.replace(/([^y]\snineteen(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (30 km)$2'); txt.value=txt.value.replace(/([^y]\stwenty(?:\s|-| )miles?)(\s[^p\(\)]{2})/gi, '$1 (32 km)$2'); //mile per hour txt.value=txt.value.replace(/m\.p\.h\.(\W)/g, 'mph$1'); txt.value=txt.value.replace(/(\d)\s?mph/gi, '$1 mph'); txt.value=txt.value.replace(/(\d)\-mph/gi, '$1 mph'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}00),?(000)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}0),?(000)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}),?(000)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3})?,?(\d{1,3})(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2$3|mph|km/h|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2|mph|km/h|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d]\s)(\d{1,3}\.\d\d\d)(?:\s|-| )mph([^\(\)]{3})/gi, '$1\{\{convert|$2|mph|km/h|abbr=on\}\}$3'); // square mile txt.value=txt.value.replace(/([^\|])sq\.?\s?mi/gi, '$1sq mi'); txt.value=txt.value.replace(/sq\.? mi/gi, 'sq mi'); txt.value=txt.value.replace(/mile²/gi, 'sq mi'); txt.value=txt.value.replace(/miles²/gi, 'sq mi'); txt.value=txt.value.replace(/mi²/gi, 'sq mi'); txt.value=txt.value.replace(/mi&sup2;/gi, 'sq mi'); txt.value=txt.value.replace(/\[\[(square\smile)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[square\smile\|(sq\smi)\]\]/gi, '$1'); txt.value=txt.value.replace(/(sq)(?:\s|-| )(mile)/gi, '$1uare $2'); // square mile:plural txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )miles([^²\(]{4})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )miles([^²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|\}\}$6');   // square mile:singular txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )square(?:\s|-| )miles?([^s²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|\}\}$6'); // square mile:abbreviated txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4|sqmi|km2|abbr=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|abbr=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(\.\d\d)(?:\s|-| )sq(?:\s|-| )mi([^l²\(]{2})/gi, '$1\{\{convert|$2$3$4$5|sqmi|km2|abbr=on\}\}$6');   //nautical mile txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}00),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}00),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}0),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}0),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3}00)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3}00)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3}0)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3}0)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3})(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}),?(\d{1,3})(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2$3|nmi|km mi|abbr=on\}\}$4'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}000)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}00)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}00)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}0)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3}0)(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|abbr=on\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )miles?([^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|\}\}$3'); txt.value=txt.value.replace(/([^\d,\.])(\d{1,3})(?:\s|-| )mi([^l²\(\)]{2})al(?:\s|-| )mi(\s[^p\(\)]{2})/gi, '$1\{\{convert|$2|nmi|km mi|abbr=on\}\}$3'); //acre //acres - temporary change to protect acre feet. changed below txt.value=txt.value.replace(/(acre.feet)/gi, 'xtempx$1ytempy'); txt.value=txt.value.replace(/\[\[(acres?)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(acre)/gi, '$1 $2'); txt.value=txt.value.replace(/(\d)(?:\s|-| )surface(?:\s|-| )(acre)/gi, '$1 $2'); txt.value=txt.value.replace(/(\s250(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (1 km²)$2'); txt.value=txt.value.replace(/(\s500(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2 km²)$2'); txt.value=txt.value.replace(/(\s750(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (3 km²)$2'); txt.value=txt.value.replace(/(\s1(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4 km²)$2'); txt.value=txt.value.replace(/(\s1,?500(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (6 km²)$2'); txt.value=txt.value.replace(/(\s2(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (8 km²)$2'); txt.value=txt.value.replace(/(\s2,?500(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (10 km²)$2'); txt.value=txt.value.replace(/(\s3(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (12 km²)$2'); txt.value=txt.value.replace(/(\s4(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (16 km²)$2'); txt.value=txt.value.replace(/(\s5(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (20 km²)$2'); txt.value=txt.value.replace(/(\s6(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (24 km²)$2'); txt.value=txt.value.replace(/(\s7(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (28 km²)$2'); txt.value=txt.value.replace(/(\s8(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (32 km²)$2'); txt.value=txt.value.replace(/(\s9(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (36 km²)$2'); txt.value=txt.value.replace(/(\s10(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (40 km²)$2'); txt.value=txt.value.replace(/(\s11(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (44 km²)$2'); txt.value=txt.value.replace(/(\s12(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (49 km²)$2'); txt.value=txt.value.replace(/(\s13(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (53 km²)$2'); txt.value=txt.value.replace(/(\s14(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (57 km²)$2'); txt.value=txt.value.replace(/(\s15(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (61 km²)$2'); txt.value=txt.value.replace(/(\s16(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (65 km²)$2'); txt.value=txt.value.replace(/(\s17(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (69 km²)$2'); txt.value=txt.value.replace(/(\s18(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (73 km²)$2'); txt.value=txt.value.replace(/(\s19(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (77 km²)$2'); txt.value=txt.value.replace(/(\s20(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (80 km²)$2'); txt.value=txt.value.replace(/(\s30(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (120 km²)$2'); txt.value=txt.value.replace(/(\s40(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (160 km²)$2'); txt.value=txt.value.replace(/(\s50(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (200 km²)$2'); txt.value=txt.value.replace(/(\s60(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (240 km²)$2'); txt.value=txt.value.replace(/(\s70(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (280 km²)$2'); txt.value=txt.value.replace(/(\s80(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (320 km²)$2'); txt.value=txt.value.replace(/(\s90(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (360 km²)$2'); txt.value=txt.value.replace(/(\s100(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (400 km²)$2'); txt.value=txt.value.replace(/(\s110(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (440 km²)$2'); txt.value=txt.value.replace(/(\s120(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (490 km²)$2'); txt.value=txt.value.replace(/(\s130(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (530 km²)$2'); txt.value=txt.value.replace(/(\s140(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (570 km²)$2'); txt.value=txt.value.replace(/(\s150(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (610 km²)$2'); txt.value=txt.value.replace(/(\s160(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (650 km²)$2'); txt.value=txt.value.replace(/(\s170(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (690 km²)$2'); txt.value=txt.value.replace(/(\s180(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (730 km²)$2'); txt.value=txt.value.replace(/(\s190(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (770 km²)$2'); txt.value=txt.value.replace(/(\s200(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (800 km²)$2'); txt.value=txt.value.replace(/(\s300(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (1,200 km²)$2'); txt.value=txt.value.replace(/(\s400(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (1,600 km²)$2'); txt.value=txt.value.replace(/(\s500(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,000 km²)$2'); txt.value=txt.value.replace(/(\s600(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,400 km²)$2'); txt.value=txt.value.replace(/(\s700(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,800 km²)$2'); txt.value=txt.value.replace(/(\s800(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (3,200 km²)$2'); txt.value=txt.value.replace(/(\s900(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (3,600 km²)$2'); txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4 km²)$2'); txt.value=txt.value.replace(/(\sa(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4 km²)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (8 km²)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (12 km²)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (16 km²)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (20 km²)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (24 km²)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (28 km²)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (32 km²)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (36 km²)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )thousand(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (40 km²)$2'); txt.value=txt.value.replace(/(\s1(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4,000 km²)$2'); txt.value=txt.value.replace(/(\s1,?500(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (6,000 km²)$2'); txt.value=txt.value.replace(/(\s2(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (8,000 km²)$2'); txt.value=txt.value.replace(/(\s2,?500(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (10,000 km²)$2'); txt.value=txt.value.replace(/(\s3(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (12,000 km²)$2'); txt.value=txt.value.replace(/(\s4(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (16,000 km²)$2'); txt.value=txt.value.replace(/(\s5(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (20,000 km²)$2'); txt.value=txt.value.replace(/(\s6(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (24,000 km²)$2'); txt.value=txt.value.replace(/(\s7(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (28,000 km²)$2'); txt.value=txt.value.replace(/(\s8(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (32,000 km²)$2'); txt.value=txt.value.replace(/(\s9(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (36,000 km²)$2'); txt.value=txt.value.replace(/(\s10(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (40,000 km²)$2'); txt.value=txt.value.replace(/(\s11(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (44,000 km²)$2'); txt.value=txt.value.replace(/(\s12(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (49,000 km²)$2'); txt.value=txt.value.replace(/(\s13(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (53,000 km²)$2'); txt.value=txt.value.replace(/(\s14(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (57,000 km²)$2'); txt.value=txt.value.replace(/(\s15(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (61,000 km²)$2'); txt.value=txt.value.replace(/(\s16(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (65,000 km²)$2'); txt.value=txt.value.replace(/(\s17(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (69,000 km²)$2'); txt.value=txt.value.replace(/(\s18(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (73,000 km²)$2'); txt.value=txt.value.replace(/(\s19(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (77,000 km²)$2'); txt.value=txt.value.replace(/(\s20(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (80,000 km²)$2'); txt.value=txt.value.replace(/(\s30(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (120,000 km²)$2'); txt.value=txt.value.replace(/(\s40(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (160,000 km²)$2'); txt.value=txt.value.replace(/(\s50(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (200,000 km²)$2'); txt.value=txt.value.replace(/(\s60(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (240,000 km²)$2'); txt.value=txt.value.replace(/(\s70(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (280,000 km²)$2'); txt.value=txt.value.replace(/(\s80(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (320,000 km²)$2'); txt.value=txt.value.replace(/(\s90(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (360,000 km²)$2'); txt.value=txt.value.replace(/(\s100(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (400,000 km²)$2'); txt.value=txt.value.replace(/(\s110(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (440,000 km²)$2'); txt.value=txt.value.replace(/(\s120(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (490,000 km²)$2'); txt.value=txt.value.replace(/(\s130(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (530,000 km²)$2'); txt.value=txt.value.replace(/(\s140(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (570,000 km²)$2'); txt.value=txt.value.replace(/(\s150(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (610,000 km²)$2'); txt.value=txt.value.replace(/(\s160(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (650,000 km²)$2'); txt.value=txt.value.replace(/(\s170(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (690,000 km²)$2'); txt.value=txt.value.replace(/(\s180(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (730,000 km²)$2'); txt.value=txt.value.replace(/(\s190(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (770,000 km²)$2'); txt.value=txt.value.replace(/(\s200(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (800,000 km²)$2'); txt.value=txt.value.replace(/(\s300(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (1,200,000 km²)$2'); txt.value=txt.value.replace(/(\s400(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (1,600,000 km²)$2'); txt.value=txt.value.replace(/(\s500(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,000,000 km²)$2'); txt.value=txt.value.replace(/(\s600(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,400,000 km²)$2'); txt.value=txt.value.replace(/(\s700(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (2,800,000 km²)$2'); txt.value=txt.value.replace(/(\s800(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (3,200,000 km²)$2'); txt.value=txt.value.replace(/(\s900(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (3,600,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sone(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4,000 km²)$2'); txt.value=txt.value.replace(/(\sa(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (4,000 km²)$2'); txt.value=txt.value.replace(/([^y]\stwo(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (8,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sthree(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (12,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sfour(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (16,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sfive(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (20,000 km²)$2'); txt.value=txt.value.replace(/([^y]\ssix(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (24,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sseven(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (28,000 km²)$2'); txt.value=txt.value.replace(/([^y]\seight(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (32,000 km²)$2'); txt.value=txt.value.replace(/([^y]\snine(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (36,000 km²)$2'); txt.value=txt.value.replace(/([^y]\sten(?:\s|-| )million(?:\s|-| )acres?)([^\(]{4})/gi, '$1 (40,000 km²)$2'); //acre:plural txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|acre|ha|\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{3})(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2|acre|ha|\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{1}00)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{2}0)(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{3})(?:\s|-| )(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([^\(]{2})/gi, '$1\{\{convert|$2$3$4$5|acre|ha|\}\}$6'); //acre:singular txt.value=txt.value.replace(/([^\/]\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})(?:\s|-| )(?:acre|\[\[acre\]\])(\s[^\(\/])/gi, '$1\{\{convert|$2$3$4|acre|ha|sing=on\}\}$5'); txt.value=txt.value.replace(/(\s)(\d{3})(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2|acre|ha|sing=on\}\}$3'); txt.value=txt.value.replace(/(\s)(\d{3})(\.\d)?(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3|acre|ha|sing=on\}\}$4'); txt.value=txt.value.replace(/(\s)(\d{1,3}),?(000),?(000),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}00),?(000),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}0),?(000),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3}),?(000),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}00),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}0),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3}),?(000)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{1}00)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{2}0)(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); txt.value=txt.value.replace(/(\s)(\d{1,3})?,?(\d{1,3})?,?(\d{1,3})?,?(\d{3})(?:\s|-| )(?:acre|\[\[acre\]\])([^s\(][^\(])/gi, '$1\{\{convert|$2$3$4$5|acre|ha|sing=on\}\}$6'); //undo protection for acre feet txt.value=txt.value.replace(/xtempx(acre.feet)ytempy/gi, '$1'); // foot pound txt.value=txt.value.replace(/ftlbs?(\W)/gi, 'ft•lbf$1'); txt.value=txt.value.replace(/ft[ -.••\/]lb(\W)/gi, 'ft•lbf$1'); txt.value=txt.value.replace(/ft[ -.••\/]lbs/gi, 'ft•lbf'); txt.value=txt.value.replace(/ft[ -.••\/]lbf/gi, 'ft•lbf'); txt.value=txt.value.replace(/ft[ -.••\/]lbff/gi, 'ft•lbf'); //foot (again). Parsed after 'foot per second' and 'foot pound' txt.value=txt.value.replace(/\[\[(feet)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Foot\s\(unit\sof\slength\)\|(feet:foot|ft)\]\]/gi, '$1'); txt.value=txt.value.replace(/(\d)-(feet)/gi, '$1 $2'); //feet: plural txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(000)[\s,]?(000)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}00)[\s,]?(000)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}0)[\s,]?(000)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})[\s,]?(000)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}00)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}0)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4$5|ft|m|\}\}$6'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d\d)(?:\s|-| )feet([^\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4$5|ft|m|\}\}$6'); //feet: singular txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(000)[\s,]?(000)(?:\s|-| )foot([^\aip\(\)]{2})/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}00)[\s,]?(000)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}0)[\s,]?(000)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})[\s,]?(000)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}00)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}0)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4|ft|m|sing=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4$5|ft|m|sing=on\}\}$6'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d\d)(?:\s|-| )foot([^•\w\(\)][^o\d\(\)])/gi, '$1\{\{convert|$2$3$4$5|ft|m|sing=on\}\}$6'); //feet: abbreviated txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(000)[\s,]?(000)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}00)[\s,]?(000)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3}0)[\s,]?(000)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})[\s,]?(000)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}00)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3}0)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4|ft|m|abbr=on\}\}$5'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4$5|ft|m|abbr=on\}\}$6'); txt.value=txt.value.replace(/([^\dr]\s)(\d{1,3})?[\s,]?(\d{1,3})?[\s,]?(\d{1,3})(\.\d\d)(?:\s|-| )ft([^\w\(\)\/][^lo\d\(\)][^\(])/gi, '$1\{\{convert|$2$3$4$5|ft|m|abbr=on\}\}$6');   // horsepower txt.value=txt.value.replace(/(\d)\s?hp(\W)/gi, '$1 hp$2'); txt.value=txt.value.replace(/(\d) hp(\W)/gi, '$1 hp$2'); txt.value=txt.value.replace(/(\d)\s?bhp/gi, '$1 bhp'); txt.value=txt.value.replace(/(\d) bhp/gi, '$1 bhp'); txt.value=txt.value.replace(/(\d)\s?shp/gi, '$1 shp'); txt.value=txt.value.replace(/(\d) shp/gi, '$1 shp');    //Pferdestärke txt.value=txt.value.replace(/(\d)\s?(ps\W)/gi, '$1 $2');    // rpm txt.value=txt.value.replace(/(\d)\s?rpm/gi, '$1 rpm'); txt.value=txt.value.replace(/(\d) rpm/gi, '$1 rpm'); txt.value=txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');    // decibel txt.value=txt.value.replace(/(\d)\s?(dB)\b/g, '$1 $2');    // bits per second txt.value=txt.value.replace(/([KkMmGgTt])(bps|bits?\/s|b\/s)/g, '$1bit/s'); txt.value=txt.value.replace(/(\d)\s?bps/gi, '$1 bit/s'); txt.value=txt.value.replace(/(\d) bps/gi, '$1 bit/s'); txt.value=txt.value.replace(/bits?\/sec(\W)/gi, 'bit/s$1'); // bytes per second txt.value=txt.value.replace(/([KkMmGgTt])(Bps|bytes?\/s)/g, ' $1byte/s'); txt.value=txt.value.replace(/bytes?\/s(\W)/gi, 'byte/s$1'); // capitalization of prefix with bits and bytes txt.value=txt.value.replace(/K(bit|B|byte)\/s/g, 'k$1/s'); txt.value=txt.value.replace(/m(bit|B|byte)\/s/g, 'M$1/s'); txt.value=txt.value.replace(/g(bit|B|byte)\/s/g, 'G$1/s'); txt.value=txt.value.replace(/t(bit|B|byte)\/s/g, 'T$1/s'); // space with bits and bytes txt.value=txt.value.replace(/([^\w]\d)\s?(k|M|G|T)(bit|B)/g, '$1 $2$3'); //Remove surprise or 'Easter egg' diversions linking unit name to orders of magnitude articles txt.value=txt.value.replace(/\[\[1\s?_?E\s?[\-\+]?\d{1,2}\s?..?\|([^\]]{1,50})\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Orders\sof\smagnitude\s\([^\)]{1,30}\)\|([^\]]{1,50})\]\]/gi, '$1');   //'present' txt.value=txt.value.replace(/\[\[Present \(time\)\|(Present)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(Present)\]\]/gi, '$1');    //Season txt.value=txt.value.replace(/\[\[(spring\s\(season\)|summer|winter|autumn)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[spring\s\(season\)\|(spring)\]\]/gi, '$1');    //Identify surprise or 'Easter egg' diversions linking months to year articles. txt.value=txt.value.replace(/\[\[\d{1,4}#[^\|]{1,30}\|(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1');    // months txt.value=txt.value.replace(/\[\[\s?(January|February|March|April|May|June|July|August|September|October|November|December)\s?\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1'); //Treat 'Sept' (i.e. month abbreviation) differently from 'sept' (i.e. family) txt.value=txt.value.replace(/\[\[(Sept)\]\]/g, '$1'); txt.value=txt.value.replace(/\[\[January\|(Jan)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[February\|(Feb)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[March\|(Mar)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[April\|(Apr)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[May\|(May)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[June\|(Jun)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[July\|(Jul)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[August\|(Aug)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[September\|(Sep)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[October\|(Oct)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[November\|(Nov)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[December\|(Dec)\]\]/gi, '$1'); //month piped to number txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,4})\]\]/gi, '$1'); //Month+day_number "March 7th" -> "March 7" txt.value=txt.value.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December) (\d?\d)(?:th|st|nd|rd)\]\]/gi, '\[\[$1 $2\]\]'); txt.value=txt.value.replace(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](?:th|st|nd|rd)/gi, '\[\[$1\]\]'); txt.value=txt.value.replace(/\[\[(\d?\d)(?:th|st|nd|rd) (January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '\[\[$1 $2\]\]'); //Month+day_number piped into number. Preferences do not work. They don't work in sequence because digits in the two dates must be adjacent txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with ndash or mdash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with slash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\s?\-?\s?)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with ndash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with slash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d?\d)\]\](\/)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with ndash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with slash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1$2$3$4'); txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with ndash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); //same again but with slash instead of hyphen txt.value=txt.value.replace(/([^\[]{4})\[\[(\d?\d) (?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4'); txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[\d{1,2} (?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2})\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}\|((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{1,2})\]\]/gi, '$1'); //month+day piped into month+day or vice versa txt.value=txt.value.replace(/\[\[\d{1,2}\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2})\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}\|(\d{1,2}\s(?:January|February|March|April|May|June|July|August|September|October|November|December))\]\]/gi, '$1'); // days of the week in full. Optional plurals txt.value=txt.value.replace(/\[\[(Mondays?|Tuesdays?|Wednesdays?|Thursdays?|Fridays?|Saturdays?|Sundays?)\]\]/gi, '$1'); // days of the week abbreviated. Leave out 'Sun' as potentially valid link to the Sun. Leave out 'SAT' in upper case as potential link to 'Scholastic achievement/aptitude test'. txt.value=txt.value.replace(/\[\[(Mon|Tue|Tues|Wed|Thu|Thur|Thurs|Fri)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[(Sat)\]\]/g, '$1'); txt.value=txt.value.replace(/\[\[Mondays?\|(Mondays?|Mon)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Tuesdays?\|(Tuesdays?|Tues?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Wednesdays?\|(Wednesdays?|Wed)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Thursdays?\|(Thursdays?|Thur?)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Fridays?\|(Fridays?|Fri)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Saturdays?\|(Saturdays?|Sat)\]\]/gi, '$1'); txt.value=txt.value.replace(/\[\[Sundays?\|(Sundays?|Sun)\]\]/gi, '$1'); //4 digit years piped into 2 txt.value=txt.value.replace(/\[\[\d{1,4}\|(\d{1,2})\]\]/gi, '$1'); } function run_dates { var txt = document.editform.wpTextbox1; dates; // Add a tag to the summary box var txt = document.editform.wpSummary; var summary = "Dates"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) { txt.value += " | "; }		txt.value += summary; }   // Press the diff button to check it    document.editform.wpDiff.click } $(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:run_dates', 'dates', 'ca-unitfixer', 'Fixes some unit formatting', , );    } }); function run_formatgeneral { var txt = document.editform.wpTextbox1; formatgeneral; // Add a tag to the summary box var txt = document.editform.wpSummary; var summary = "Format per wp:mosnum; units and/or dates using this Script"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) { txt.value += " | "; }		txt.value += summary; }   // Press the diff button to check it    document.editform.wpDiff.click } $(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:run_formatgeneral', 'Units', 'ca-unitfixer', 'Fixes some unit formatting', , );    } }); function combined { var txt = document.editform.wpTextbox1; formatgeneral; dates; // Add a tag to the summary box var txt = document.editform.wpSummary; var summary = "Format per WP:MOSNUM; units and/or dates using this Script"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) { txt.value += " | "; }		txt.value += summary; }   // Press the diff button to check it    document.editform.wpDiff.click } $(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:combined', 'combined', 'ca-unitfixer', 'Fixes some unit formatting', , );    } }); // Script from User:ais523/editcount.js document.write(' ');