Misplaced Pages

User:Ohconfucius/test/Common Terms.js

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Ohconfucius

This is an old revision of this page, as edited by Ohconfucius (talk | contribs) at 10:42, 13 June 2022 (testing new function for pathoschild.templatescript). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 10:42, 13 June 2022 by Ohconfucius (talk | contribs) (testing new function for pathoschild.templatescript)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
This user script seems to have a documentation page at User:Ohconfucius/test/Common Terms.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Misplaced Pages:Bypass your cache.
// *********************************************************************************************
//This is a non-production script, and may have untested errors. Please exercise due care should you decide to use it.
// *********************************************************************************************
//<syntaxhighlight lang=javascript>
function ohc_unlinkflag(){
 var txt=document.editform.wpTextbox1;
//	levelling
	regex(/\{\{(\s?country\s?|\sflag\s?)\|/gi, '{{Flag|');
//	remove naming and flag templates and replacing with country name only
	regex(/\{\{(?:flag(?:country|)\|*(ABW|ARU|Aruba)|ABW|ARU)(\|+|)\}\}/g, '{{Flagu|Aruba$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AFG|Afghanistan)|AFG)(\|+|)\}\}/g, '{{Flagu|Afghanistan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AGO|ANG|Angola)|AGO|ANG)(\|+|)\}\}/g, '{{Flagu|Angola$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AHO|Netherlands Antilles)|AHO)(\|+|)\}\}/g, '{{Flagu|Netherlands Antilles$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AIA|Anguilla)|AIA)(\|+|)\}\}/g, '{{Flagu|Anguilla$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ALA|Åland Islands)|ALA)(\|+|)\}\}/g, '{{Flagu|Åland Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ALB|Albania)|ALB)(\|+|)\}\}/g, '{{Flagu|Albania$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AND|Andorra)|AND)(\|+|)\}\}/g, '{{Flagu|Andorra$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ANT|Antigua (?:and|&) Barbuda)|ANT)(\|+|)\}\}/g, '{{Flagu|Antigua and Barbuda$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ARE|UAE|United Arab Emirates)|ARE|UAE)(\|+|)\}\}/g, '{{Flagu|United Arab Emirates$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ARG|Argentina)|ARG)(\|+|)\}\}/g, '{{Flagu|Argentina$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ARM|Armenia)|ARM)(\|+|)\}\}/g, '{{Flagu|Armenia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ASM|SAM|ASA|American Samoa)|ASM|SAM|ASA)(\|+|)\}\}/g, '{{Flagu|American Samoa$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ATA|Antarctica)|ATA)(\|+|)\}\}/g, '{{Flagu|Antarctica$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ATF|French Southern Territories)|ATF)(\|+|)\}\}/g, '{{Flagu|French Southern Territories$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ATG|Antigua (?:and|&) Barbuda)|ATG)(\|+|)\}\}/g, '{{Flagu|Antigua and Barbuda$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AUS|Australia)|AUS)(\|+|)\}\}/g, '{{Flagu|Australia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AUT|Austria)|AUT)(\|+|)\}\}/g, '{{Flagu|Austria$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(AZE|Azerbaijan)|AZE)(\|+|)\}\}/g, '{{Flagu|Azerbaijan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BDI|Burundi)|BDI)(\|+|)\}\}/g, '{{Flagu|Burundi$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BEL|Belgium)|BEL)(\|+|)\}\}/g, '{{Flagu|Belgium$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BEN|Benin)|BEN)(\|+|)\}\}/g, '{{Flagu|Benin$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BES|Bonaire, Sint Eustatius and Saba)|BES)(\|+|)\}\}/g, '{{Flagu|Bonaire, Sint Eustatius and Saba$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BFA|BUR|Burkina Faso)|BFA|BUR)(\|+|)\}\}/g, '{{Flagu|Burkina Faso$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BGD|BAN|Bangladesh)|BGD|BAN)(\|+|)\}\}/g, '{{Flagu|Bangladesh$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BGR|BUL|Bulgaria)|BGR|BUL)(\|+|)\}\}/g, '{{Flagu|Bulgaria$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BHN|BHR|Bahrain)|BHN|BHR)(\|+|)\}\}/g, '{{Flagu|Bahrain$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BHS|BAH|Bahamas)|BHS|BAH)(\|+|)\}\}/g, '{{Flagu|Bahamas$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BIH|Bosnia (?:and|&) Herzegovina)|BIH)(\|+|)\}\}/g, '{{Flagu|Bosnia and Herzegovina$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BLM|(?:Saint|St.?) Barthélemy)|BLM)(\|+|)\}\}/g, '{{Flagu|Saint Barthélemy$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BLR|Belarus)|BLR)(\|+|)\}\}/g, '{{Flagu|Belarus$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BLZ|BIZ|Belize)|BLZ|BIZ)(\|+|)\}\}/g, '{{Flagu|Belize$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BMU|BER|Bermuda)|BMU|BER)(\|+|)\}\}/g, '{{Flagu|Bermuda$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BOL|Bolivia)|BOL)(\|+|)\}\}/g, '{{Flagu|Bolivia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BRA|Brazil)|BRA)(\|+|)\}\}/g, '{{Flagu|Brazil$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BRB|BAR|Barbados)|BRB|BAR)(\|+|)\}\}/g, '{{Flagu|Barbados$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BRN|BRU|Brunei)|BRN|BRU)(\|+|)\}\}/g, '{{Flagu|Brunei$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BTN|BHU|Bhutan)|BTN|BHU)(\|+|)\}\}/g, '{{Flagu|Bhutan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BVT|Bouvet Island)|BVT)(\|+|)\}\}/g, '{{Flagu|Bouvet Island$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BWA|BOT|Botswana)|BWA|BOT)(\|+|)\}\}/g, '{{Flagu|Botswana$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(BIR|Burma)|BIR)(\|+|)\}\}/g, '{{Flagu|Burma$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CAF|Central African Republic)|CAF)(\|+|)\}\}/g, '{{Flagu|Central African Republic$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CAN|Canada)|CAN)(\|+|)\}\}/g, '{{Flagu|Canada$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CCK|Cocos (Keeling) Islands)|CCK)(\|+|)\}\}/g, '{{Flagu|Cocos (Keeling) Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CHE|SI|Switzerland)|CHE|SI)(\|+|)\}\}/g, '{{Flagu|Switzerland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CHL|CHI|Chile)|CHL|CHI)(\|+|)\}\}/g, '{{Flagu|Chile$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CHN|PRC|(?:People\'s Republic of |)China)|CHN|PRC)(\|+|)\}\}/g, '{{Flagu|China$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CIV|Côte d'Ivoire)|CIV)(\|+|)\}\}/g, '{{Flagu|Côte d\'Ivoire$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CMR|Cameroon)|CMR)(\|+|)\}\}/g, '{{Flagu|Cameroon$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(COD|Democratic Republic of the Congo)|COD)(\|+|)\}\}/g, '{{Flagu|Democratic Republic of the Congo$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(COG|CGO|Republic of the Congo|Congo, Republic of the)|COG|CGO)(\|+|)\}\}/g, '{{Flagu|Republic of the Congo$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(COK|Cook Islands)|COK)(\|+|)\}\}/g, '{{Flagu|Cook Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(COL|Colombia)|COL)(\|+|)\}\}/g, '{{Flagu|Colombia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(COM|Comoros)|COM)(\|+|)\}\}/g, '{{Flagu|Comoros$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CPV|Cape Verde)|CPV)(\|+|)\}\}/g, '{{Flagu|Cape Verde$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CRI|CRC|Costa Rica)|CRI|CRC)(\|+|)\}\}/g, '{{Flagu|Costa Rica$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CUB|Cuba)|CUB)(\|+|)\}\}/g, '{{Flagu|Cuba$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CU|Curaçao)|CU)(\|+|)\}\}/g, '{{Flagu|Curaçao$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CXR|Christmas Island)|CXR)(\|+|)\}\}/g, '{{Flagu|Christmas Island$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CYM|CAY|Cayman Islands)|CYM|CAY)(\|+|)\}\}/g, '{{Flagu|Cayman Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CYP|Cyprus)|CYP)(\|+|)\}\}/g, '{{Flagu|Cyprus$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CS|Czechoslovakia)|CS)(\|+|)\}\}/g, '{{Flagu|Czechoslovakia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(CZE|Czech Republic)|CZE)(\|+|)\}\}/g, '{{Flagu|Czech Republic$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DDR|East Germany)|DDR)(\|+|)\}\}/g, '{{Flagu|East Germany$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DEU|GER|(?:Nazi |)Germany)|DEU|GER)(\|+|)\}\}/g, '{{Flagu|Germany$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DJI|Djibouti)|DJI)(\|+|)\}\}/g, '{{Flagu|Djibouti$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DMA|Dominica)|DMA)(\|+|)\}\}/g, '{{Flagu|Dominica$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DNK|DEN|Denmark)|DNK|DEN)(\|+|)\}\}/g, '{{Flagu|Denmark$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DOM|Dominican Republic)|DOM)(\|+|)\}\}/g, '{{Flagu|Dominican Republic$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(DZA|ALG|Algeria)|DZA|ALG)(\|+|)\}\}/g, '{{Flagu|Algeria$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ECU|Ecuador)|ECU)(\|+|)\}\}/g, '{{Flagu|Ecuador$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(EGY|Egypt)|EGY)(\|+|)\}\}/g, '{{Flagu|Egypt$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ENG|England)|ENG)(\|+|)\}\}/g, '{{Flagu|England$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ERI|Eritrea)|ERI)(\|+|)\}\}/g, '{{Flagu|Eritrea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ESH|Western Sahara)|ESH)(\|+|)\}\}/g, '{{Flagu|Western Sahara$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ESP|SP|Spain)|ESP|SP)(\|+|)\}\}/g, '{{Flagu|Spain$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(EST|Estonia)|EST)(\|+|)\}\}/g, '{{Flagu|Estonia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ETH|Ethiopia)|ETH)(\|+|)\}\}/g, '{{Flagu|Ethiopia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FIN|Finland)|FIN)(\|+|)\}\}/g, '{{Flagu|Finland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FJI|FIJ|Fiji)|FJI|FIJ)(\|+|)\}\}/g, '{{Flagu|Fiji$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FLK|Falkland Islands)|FLK)(\|+|)\}\}/g, '{{Flagu|Falkland Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FRA|France)|FRA)(\|+|)\}\}/g, '{{Flagu|France$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FRG|West Germany)|FRG)(\|+|)\}\}/g, '{{Flagu|West Germany$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FRO|Faroe Islands)|FRO)(\|+|)\}\}/g, '{{Flagu|Faroe Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(FSM|(?:Federated States of |)Micronesia)|FSM)(\|+|)\}\}/g, '{{Flagu|Federated States of Micronesia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GAB|Gabon)|GAB)(\|+|)\}\}/g, '{{Flagu|Gabon$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GBR|GRB|UK|United Kingdom)|GBR|GRB|UK)(\|+|)\}\}/g, '{{Flagu|United Kingdom$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GBR2|Great Britain)|GBR2)(\|+|)\}\}/g, '{{Flagu|Great Britain$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GDR|East Germany)|GDR)(\|+|)\}\}/g, '{{Flagu|East Germany$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GEO|Georgia)|GEO)(\|+|)\}\}/g, '{{Flagu|Georgia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GGY|Guernsey)|GGY)(\|+|)\}\}/g, '{{Flagu|Guernsey$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GHA|Ghana)|GHA)(\|+|)\}\}/g, '{{Flagu|Ghana$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GIB|Gibraltar)|GIB)(\|+|)\}\}/g, '{{Flagu|Gibraltar$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GIN|GUI|Guinea)|GIN|GUI)(\|+|)\}\}/g, '{{Flagu|Guinea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GLP|Guadeloupe)|GLP)(\|+|)\}\}/g, '{{Flagu|Guadeloupe$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GMB|GAM|(?:The |)Gambia)|GMB|GAM)(\|+|)\}\}/g, '{{Flagu|Gambia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GNB|GBS|Guinea-Bissau)|GNB|GBS)(\|+|)\}\}/g, '{{Flagu|Guinea-Bissau$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GNQ|GEQ|Equatorial Guinea)|GNQ|GEQ)(\|+|)\}\}/g, '{{Flagu|Equatorial Guinea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GRC|GRE|Greece)|GRC|GRE)(\|+|)\}\}/g, '{{Flagu|Greece$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GRD|GRN|Grenada)|GRD|GRN)(\|+|)\}\}/g, '{{Flagu|Grenada$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GRL|Greenland)|GRL)(\|+|)\}\}/g, '{{Flagu|Greenland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GTM|GUA|Guatemala)|GTM|GUA)(\|+|)\}\}/g, '{{Flagu|Guatemala$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GUF|French Guiana)|GUF)(\|+|)\}\}/g, '{{Flagu|French Guiana$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GUM|Guam)|GUM)(\|+|)\}\}/g, '{{Flagu|Guam$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(GUY|Guyana)|GUY)(\|+|)\}\}/g, '{{Flagu|Guyana$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HKG|Hong Kong)|HKG)(\|+|)\}\}/g, '{{Flagu|Hong Kong$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HMD|Heard Island (?:and|&) McDonald Islands)|HMD)(\|+|)\}\}/g, '{{Flagu|Heard Island and McDonald Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HND|HON|Honduras)|HND|HON)(\|+|)\}\}/g, '{{Flagu|Honduras$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HRV|CRO|Croatia)|HRV|CRO)(\|+|)\}\}/g, '{{Flagu|Croatia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HTI|HAI|Haiti)|HTI|HAI)(\|+|)\}\}/g, '{{Flagu|Haiti$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(HUN|Hungary)|HUN)(\|+|)\}\}/g, '{{Flagu|Hungary$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IDN|INA|Indonesia)|IDN|INA)(\|+|)\}\}/g, '{{Flagu|Indonesia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IMN|IOM|Isle of Man)|IMN|IOM)(\|+|)\}\}/g, '{{Flagu|Isle of Man$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IND|India)|IND)(\|+|)\}\}/g, '{{Flagu|India$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IOT|British Indian Ocean Territory)|IOT)(\|+|)\}\}/g, '{{Flagu|British Indian Ocean Territory$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IRL|Ireland)|IRL)(\|+|)\}\}/g, '{{Flagu|Ireland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IRN|IRI|Iran)|IRN|IRI)(\|+|)\}\}/g, '{{Flagu|Iran$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(IRQ|Iraq)|IRQ)(\|+|)\}\}/g, '{{Flagu|Iraq$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ISL|Iceland)|ISL)(\|+|)\}\}/g, '{{Flagu|Iceland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ISR|Israel)|ISR)(\|+|)\}\}/g, '{{Flagu|Israel$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ITA|Italy)|ITA)(\|+|)\}\}/g, '{{Flagu|Italy$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(JAM|Jamaica)|JAM)(\|+|)\}\}/g, '{{Flagu|Jamaica$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(JEY|Jersey)|JEY)(\|+|)\}\}/g, '{{Flagu|Jersey$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(JOR|Jordan)|JOR)(\|+|)\}\}/g, '{{Flagu|Jordan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(JPN|JAP|Japan)|JPN|JAP)(\|+|)\}\}/g, '{{Flagu|Japan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KAZ|Kazakhstan)|KAZ)(\|+|)\}\}/g, '{{Flagu|Kazakhstan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KEN|Kenya)|KEN)(\|+|)\}\}/g, '{{Flagu|Kenya$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KGZ|Kyrgyzstan)|KGZ)(\|+|)\}\}/g, '{{Flagu|Kyrgyzstan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KHM|CAM|Cambodia)|KHM|CAM)(\|+|)\}\}/g, '{{Flagu|Cambodia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KIR|Kiribati)|KIR)(\|+|)\}\}/g, '{{Flagu|Kiribati$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KNA|SKN|(?:Saint|St.?) Kitts (?:and|&) Nevis)|KNA|SKN)(\|+|)\}\}/g, '{{Flagu|Saint Kitts and Nevis$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(?:KOR|ROK|(South |Republic of )Korea)|KOR|ROK)(\|+|)\}\}/g, '{{Flagu|$1Korea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(KWT|KUW|Kuwait)|KWT|KUW)(\|+|)\}\}/g, '{{Flagu|Kuwait$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LAO|Laos)|LAO)(\|+|)\}\}/g, '{{Flagu|Laos$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LBN|LIB|Lebanon)|LBN|LIB)(\|+|)\}\}/g, '{{Flagu|Lebanon$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LBR|Liberia)|LBR)(\|+|)\}\}/g, '{{Flagu|Liberia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LBY|LBA|Libya)|LBY|LBA)(\|+|)\}\}/g, '{{Flagu|Libya$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LCA|(?:Saint|St.?) Lucia)|LCA)(\|+|)\}\}/g, '{{Flagu|Saint Lucia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LIE|Liechtenstein)|LIE)(\|+|)\}\}/g, '{{Flagu|Liechtenstein$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LKA|SRI|Sri Lanka)|LKA|SRI)(\|+|)\}\}/g, '{{Flagu|Sri Lanka$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LSO|LES|Lesotho)|LSO|LES)(\|+|)\}\}/g, '{{Flagu|Lesotho$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LIT|LTU|Lithuania)|LIT|LTU)(\|+|)\}\}/g, '{{Flagu|Lithuania$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LUX|Luxembourg)|LUX)(\|+|)\}\}/g, '{{Flagu|Luxembourg$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(LVA|LAT|Latvia)|LVA|LAT)(\|+|)\}\}/g, '{{Flagu|Latvia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MAC|Macao)|MAC)(\|+|)\}\}/g, '{{Flagu|Macao$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MAF|(?:Saint|St.?) Martin)|MAF)(\|+|)\}\}/g, '{{Flagu|Saint Martin$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MAR|Morocco)|MAR)(\|+|)\}\}/g, '{{Flagu|Morocco$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MCO|MON|Monaco)|MCO|MON)(\|+|)\}\}/g, '{{Flagu|Monaco$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MDA|MLD|Moldova)|MDA|MLD)(\|+|)\}\}/g, '{{Flagu|Republic of Moldova$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MDG|MAD|Madagascar)|MDG|MAD)(\|+|)\}\}/g, '{{Flagu|Madagascar$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MDV|Maldives)|MDV)(\|+|)\}\}/g, '{{Flagu|Maldives$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MEX|Mxico)|MEX)(\|+|)\}\}/g, '{{Flagu|Mexico$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MHL|Marshall Islands)|MHL)(\|+|)\}\}/g, '{{Flagu|Marshall Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MKD|Macedonia)|MKD)(\|+|)\}\}/g, '{{Flagu|Macedonia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MLI|Mali)|MLI)(\|+|)\}\}/g, '{{Flagu|Mali$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MLT|Malta)|MLT)(\|+|)\}\}/g, '{{Flagu|Malta$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MMR|MYA|Myanmar)|MMR|MYA)(\|+|)\}\}/g, '{{Flagu|Myanmar$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MNE|Montenegro)|MNE)(\|+|)\}\}/g, '{{Flagu|Montenegro$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MNG|MGL|Mongolia)|MNG|MGL)(\|+|)\}\}/g, '{{Flagu|Mongolia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MNP|NMI|Northern Mariana Islands)|MNP|NMI)(\|+|)\}\}/g, '{{Flagu|Northern Mariana Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MOZ|Mozambique)|MOZ)(\|+|)\}\}/g, '{{Flagu|Mozambique$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MRT|MTN|Mauritania)|MRT|MTN)(\|+|)\}\}/g, '{{Flagu|Mauritania$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MSR|Montserrat)|MSR)(\|+|)\}\}/g, '{{Flagu|Montserrat$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MTQ|Martinique)|MTQ)(\|+|)\}\}/g, '{{Flagu|Martinique$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MUS|MRI|Mauritius)|MUS|MRI)(\|+|)\}\}/g, '{{Flagu|Mauritius$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MWI|MAW|Malawi)|MWI|MAW)(\|+|)\}\}/g, '{{Flagu|Malawi$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MYS|MAS|Malaysia)|MYS|MAS)(\|+|)\}\}/g, '{{Flagu|Malaysia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(MYT|Mayotte)|MYT)(\|+|)\}\}/g, '{{Flagu|Mayotte$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NAM|Namibia)|NAM)(\|+|)\}\}/g, '{{Flagu|Namibia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NCL|New Caledonia)|NCL)(\|+|)\}\}/g, '{{Flagu|New Caledonia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NER|NIG|Niger)|NER|NIG)(\|+|)\}\}/g, '{{Flagu|Niger$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NFK|Norfolk Island)|NFK)(\|+|)\}\}/g, '{{Flagu|Norfolk Island$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NIR|Northern Ireland)|NIR)(\|+|)\}\}/g, '{{Flagu|Northern Ireland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NGA|NGR|Nigeria)|NGA|NGR)(\|+|)\}\}/g, '{{Flagu|Nigeria$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NIC|NCA|Nicaragua)|NIC|NCA)(\|+|)\}\}/g, '{{Flagu|Nicaragua$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NIU|Niue)|NIU)(\|+|)\}\}/g, '{{Flagu|Niue$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NLD|NED|(The |)Netherlands)|NLD|NED)(\|+|)\}\}/g, '{{Flagu|Netherlands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NOR|Norway)|NOR)(\|+|)\}\}/g, '{{Flagu|Norway$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NPL|NEP|Nepal)|NPL|NEP)(\|+|)\}\}/g, '{{Flagu|Nepal$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NRU|Nauru)|NRU)(\|+|)\}\}/g, '{{Flagu|Nauru$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(NZL?|New Zealand)|NZL?)(\|+|)\}\}/g, '{{Flagu|New Zealand$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(OMN|OMA|Oman)|OMN|OMA)(\|+|)\}\}/g, '{{Flagu|Oman$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PAK|Pakistan)|PAK)(\|+|)\}\}/g, '{{Flagu|Pakistan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PAN|Panama)|PAN)(\|+|)\}\}/g, '{{Flagu|Panama$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PCN|Pitcairn Islands)|PCN)(\|+|)\}\}/g, '{{Flagu|Pitcairn Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PER|Peru)|PER)(\|+|)\}\}/g, '{{Flagu|Peru$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PHL|PHI|Philippines)|PHL|PHI)(\|+|)\}\}/g, '{{Flagu|Philippines$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PLW|Palau)|PLW)(\|+|)\}\}/g, '{{Flagu|Palau$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PNG|Papua New Guinea)|PNG)(\|+|)\}\}/g, '{{Flagu|Papua New Guinea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(POL|Poland)|POL)(\|+|)\}\}/g, '{{Flagu|Poland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PRI|PUR|Puerto Rico)|PRI|PUR)(\|+|)\}\}/g, '{{Flagu|Puerto Rico$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PRK|North Korea)|PRK)(\|+|)\}\}/g, '{{Flagu|North Korea$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PRT|POR|Portugal)|PRT|POR)(\|+|)\}\}/g, '{{Flagu|Portugal$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PRY|PAR|Paraguay)|PRY|PAR)(\|+|)\}\}/g, '{{Flagu|Paraguay$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PSE|PLE|Palestinian Territory)|PSE|PLE)(\|+|)\}\}/g, '{{Flagu|Palestinian Territory$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(PYF|French Polynesia)|PYF)(\|+|)\}\}/g, '{{Flagu|French Polynesia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(QAT|Qatar)|QAT)(\|+|)\}\}/g, '{{Flagu|Qatar$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(REU|Réunion)|REU)(\|+|)\}\}/g, '{{Flagu|Réunion$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ROC(?:-TW|)|Republic of China)|ROC(?:-TW|))(\|+|)\}\}/g, '{{Flagu|Republic of China$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ROU|ROM|Romania)|ROU|ROM)(\|+|)\}\}/g, '{{Flagu|Romania$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(RUS|Russia)|RUS)(\|+|)\}\}/g, '{{Flagu|Russia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(RWA|Rwanda)|RWA)(\|+|)\}\}/g, '{{Flagu|Rwanda$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SAU|KSA|Saudi Arabia)|SAU|KSA)(\|+|)\}\}/g, '{{Flagu|Saudi Arabia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SDN|SUD|Sudan)|SDN|SUD)(\|+|)\}\}/g, '{{Flagu|Sudan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SCO|Scotland)|SCO)(\|+|)\}\}/g, '{{Flagu|Scotland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SCG|Serbia (?:and|&) Montenegro)|SCG)(\|+|)\}\}/g, '{{Flagu|Serbia and Montenegro$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SEN|Senegal)|SEN)(\|+|)\}\}/g, '{{Flagu|Senegal$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SGP|SIN|Singapore)|SGP|SIN)(\|+|)\}\}/g, '{{Flagu|Singapore$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SGS|South Georgia and the South Sandwich Islands)|SGS)(\|+|)\}\}/g, '{{Flagu|South Georgia and the South Sandwich Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SHN|(?:Saint|St.?) Helena, Ascension (?:and|&) Tristan da Cunha)|SHN)(\|+|)\}\}/g, '{{Flagu|Saint Helena, Ascension and Tristan da Cunha$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SJM|Svalbard and Jan Mayen)|SJM)(\|+|)\}\}/g, '{{Flagu|Svalbard and Jan Mayen$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SLB|SOL|Solomon Islands)|SLB|SOL)(\|+|)\}\}/g, '{{Flagu|Solomon Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SLE|Sierra Leone)|SLE)(\|+|)\}\}/g, '{{Flagu|Sierra Leone$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SLV|ESA|El Salvador)|SLV|ESA)(\|+|)\}\}/g, '{{Flagu|El Salvador$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SMR|San Marino)|SMR)(\|+|)\}\}/g, '{{Flagu|San Marino$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SOM|Somalia)|SOM)(\|+|)\}\}/g, '{{Flagu|Somalia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SPM|(?:Saint|St.?) Pierre (?:and|&) Miquelon)|SPM)(\|+|)\}\}/g, '{{Flagu|Saint Pierre and Miquelon$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SRB|Serbia)|SRB)(\|+|)\}\}/g, '{{Flagu|Serbia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SSD|South Sudan)|SSD)(\|+|)\}\}/g, '{{Flagu|South Sudan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(STP|So Tom (?:and|&) Príncipe)|STP)(\|+|)\}\}/g, '{{Flagu|Sao Tome and Principe$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SUR|Suriname)|SUR)(\|+|)\}\}/g, '{{Flagu|Suriname$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SVK|Slovakia)|SVK)(\|+|)\}\}/g, '{{Flagu|Slovakia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SVN|SLO|Slovenia)|SVN|SLO)(\|+|)\}\}/g, '{{Flagu|Slovenia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SWE|Sweden)|SWE)(\|+|)\}\}/g, '{{Flagu|Sweden$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SWZ|Swaziland)|SWZ)(\|+|)\}\}/g, '{{Flagu|Swaziland$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SXM|Sint Maarten)|SXM)(\|+|)\}\}/g, '{{Flagu|Sint Maarten$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SYC|SEY|Seychelles)|SYC|SEY)(\|+|)\}\}/g, '{{Flagu|Seychelles$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(SYR|(Syrian Arab Republic|Syria))|SYR)(\|+|)\}\}/g, '{{Flagu|Syria$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TCA|Turks (?:and|&) Caicos Islands)|TCA)(\|+|)\}\}/g, '{{Flagu|Turks and Caicos Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TCH|Czechoslovakia)|TCH)(\|+|)\}\}/g, '{{Flagu|Czechoslovakia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TCD|CHA|Chad)|TCD|CHA)(\|+|)\}\}/g, '{{Flagu|Chad$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TGO|TOG|Togo)|TGO|TOG)(\|+|)\}\}/g, '{{Flagu|Togo$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(THA|Thailand)|THA)(\|+|)\}\}/g, '{{Flagu|Thailand$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TJK|Tajikistan)|TJK)(\|+|)\}\}/g, '{{Flagu|Tajikistan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TKL|Tokelau)|TKL)(\|+|)\}\}/g, '{{Flagu|Tokelau$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TKM|Turkmenistan)|TKM)(\|+|)\}\}/g, '{{Flagu|Turkmenistan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TLS|East Timor|Timor.Leste)|TLS)(\|+|)\}\}/g, '{{Flagu|East Timor$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TON|TGA|Tonga)|TON|TGA)(\|+|)\}\}/g, '{{Flagu|Tonga$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TTO|TRI|Trinidad (?:and|&) Tobago)|TTO|TRI)(\|+|)\}\}/g, '{{Flagu|Trinidad and Tobago$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TUN|Tunisia)|TUN)(\|+|)\}\}/g, '{{Flagu|Tunisia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TUR|Turkey)|TUR)(\|+|)\}\}/g, '{{Flagu|Turkey$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TUV|Tuvalu)|TUV)(\|+|)\}\}/g, '{{Flagu|Tuvalu$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TWN|Taiwan)|TWN)(\|+|)\}\}/g, '{{Flagu|Taiwan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(TZA|TAN|Tanzania)|TZA|TAN)(\|+|)\}\}/g, '{{Flagu|Tanzania$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(UGA|Uganda)|UGA)(\|+|)\}\}/g, '{{Flagu|Uganda$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(UKR|Ukraine)|UKR)(\|+|)\}\}/g, '{{Flagu|Ukraine$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(UMI|United States Minor Outlying Islands)|UMI)(\|+|)\}\}/g, '{{Flagu|United States Minor Outlying Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(URY|URU|Uruguay)|URY|URU)(\|+|)\}\}/g, '{{Flagu|Uruguay$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(URS|Soviet Union|USSR)|URS)(\|+|)\}\}/g, '{{Flagu|Soviet Union$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(USA?|United States(?: of America|))|USA?|U\.S\.)(\|+|)\}\}/g, '{{Flagu|United States$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(UZB|Uzbekistan)|UZB)(\|+|)\}\}/g, '{{Flagu|Uzbekistan$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VAT|Vatican City)|VAT)(\|+|)\}\}/g, '{{Flagu|Vatican City$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VCT|VIN|(?:Saint|St.?) Vincent (?:and|&) the Grenadines)|VCT|VIN)(\|+|)\}\}/g, '{{Flagu|Saint Vincent and the Grenadines$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VEN|Venezuela)|VEN)(\|+|)\}\}/g, '{{Flagu|Venezuela$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VGB|IVB|British Virgin Islands)|VGB|IVB)(\|+|)\}\}/g, '{{Flagu|British Virgin Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VIR|ISV|United States Virgin Islands)|VIR|ISV)(\|+|)\}\}/g, '{{Flagu|United States Virgin Islands$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VNM|VIE|Viet ?am)|VNM|VIE)(\|+|)\}\}/g, '{{Flagu|Vietnam$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(VUT|VAN|Vanuatu)|VUT|VAN)(\|+|)\}\}/g, '{{Flagu|Vanuatu$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(WAL|Wales)|WAL)(\|+|)\}\}/g, '{{Flagu|Wales$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(WLF|Wallis (?:and|&) Futuna)|WLF)(\|+|)\}\}/g, '{{Flagu|Wallis and Futuna$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(WSM|Samoa)|WSM)(\|+|)\}\}/g, '{{Flagu|Samoa$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(YEM|Yemen)|YEM)(\|+|)\}\}/g, '{{Flagu|Yemen$2}}');
	regex(/\{\{(?:flag(?:country|)\|*((?:FR-|)YUG|Yugoslavia)|(?:FR-|)YUG)(\|+|)\}\}/g, '{{Flagu|Yugoslavia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ZAF|RSA|South Africa)|ZAF|RSA)(\|+|)\}\}/g, '{{Flagu|South Africa$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ZAI|Zaire)|ZAI)(\|+|)\}\}/g, '{{Flagu|Zaire$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ZMB|ZAM|Zambia)|ZMB|ZAM)(\|+|)\}\}/g, '{{Flagu|Zambia$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(ZWE|ZIM|Zimbabwe)|ZWE|ZIM)(\|+|)\}\}/g, '{{Flagu|Zimbabwe$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(EU|European Union)|EU)(\|+|)\}\}/g, '{{Flagu|European Union$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(UNO|United Nations)|UNO)(\|+|)\}\}/g, '{{Flagu|United Nations$2}}');
	regex(/\{\{(?:flag(?:country|)\|*(*))\}\}/gi, '{{Flagu|$1}}'); 
//country templates that deliver a linked mini flag icon
	regex(/\{\{(Austria|Chile|China|Algeria|Iraq|Italy|Japan|New Zealand|Philippines|Tunisia)\}\}/g, '{{Flagu|$1}}'); 
} 
function Ohc_retrain_links() {
	regex(/(\\])/gi, '$1$2'); //unwind ultratop piped link
//rem leading and lagging spaces within wikilinks
	regex(/(\+(\|]*?)*(\]\])/gi, '$1$2$3');
	regex(/(\*(\|]*?)+(\]\])/gi, '$1$2$3');
	regex(/(\\|]*?)+(]*?\]\])/gi, '$1$2');
	regex(/(\\|]*?)+\|*(]+\]\])/gi, '$1|$2');
// sea  of blue – unnecessary piping
//	regex(/\|]+)\|\1(]+)\]\]/gi, ']$2'); //disabled in favour of case-sensitive simplification of piped links
///links
	regex(/\\] \\]/gi, ']');
	regex(/In \\]/g, 'For ]');
	regex(/\\]|\]\] of the) \\]/gi, ']');
	regex(/\\]|\]\] of the) \\]/gi, ']');
	regex(/\\]|\]\] in the) \\]/gi, ']');
	regex(/(Nazi) \\]/gi, ']');
	regex(/(Chinese) \\]/gi, ']');
	regex(/(\[\[)(?:March 11,|11 March) (2004 Madrid train bombings)/gi, '$1$2');
	regex(/\0)\]\]/g, ']');
	regex(/''\\]('' magazine's) \\]/gi, '\'\'Playboy$1 $2');
    regex(/\\]\s*(\\]/gi, '$1IATA airport code]]');
    regex(/\\]\s*(\\]/gi, '$1ICAO designator]]');
    regex(/\|Urdu)\]\]/gi, ']');
    regex(/(\\]) (Bollywood(?: film|))/gi, "$1 $3$2");
    regex(/(\\]) \\]/gi, "$1 $3$2");
	regex(/(anti-)\\]/gi, ']');
	regex(/\]+)(?=\])/gi, '[[$1');
//city, state
	regex(/(\\]|\|)/gi, '$1, Berkshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Buckinghamshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Cambridgeshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Lincolnshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Surrey$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '[[Kingston upon Hull$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1 upon Thames$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, North Yorkshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, South Yorkshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, West Yorkshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1$2$3'); 
	regex(/(\\]|\|)/gi, '$1, Angus$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Baden-Württemberg$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Aberdeenshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Dumfries and Galloway$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, East Lothian$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Fife$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Midlothian$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Moray$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Renfrewshire$2'); //avoid unlinking
 	regex(/(\\]|\|)/gi, '$1, Scottish Borders$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, South Lanarkshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, West Dumbartonshire$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, West Lothian$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Gwynedd$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1, Caerphilly$2'); //avoid unlinking
	regex(/(\\]|\|)/gi, '$1$2, County Mayo|$2$3$4'); //reinstate/retrain ambiguous link
	regex(/(\\]|\|)/gi, '$1, Ontario$2'); //avoid unlinking
	regex(/(\\])/gi, '$1$3$2'); //Sea of blue
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\\])/gi, '$1$3'); //useless pipe
	regex(/(\\])/gi, '$1$3'); 
	regex(/(\\])/gi, '$1$3'); 
	regex(/(\\])/gi, '$1$3'); 
	regex(/\\] of \\]/gi, '$1]]'); // retraining
	regex(/(\\] of \\])/gi, '$1 of $2'); // retraining
	regex(/\\]/gi, 'Vancouver'); //retraining
	regex(/(\]+))\|((?:Province|Region|State)s?)\]\]( of )\\])/gi, '$1|$3$4$2$5'); 
	regex(/\]+ Autonomous Region\]\]/gi, 'Xinjiang'); //retraining
	regex(/(\|Yuan|Zhou))(?: Dynasty)(?=|])/g, '$1 dynasty');	// China subdivisions
//remove redundant/chained Malay honorifics
	regex(/\\] ?(?=\[\[)/gi, '');
     //United Nations
//	regex(/(foo)(bar)/g, '$1 $2');
	regex(/(\\] \\])/gi, '$1 $2');
	regex(/(\\] by) \\]/gi, '$1 $2');
	regex(/(''')(?:\\]|United Nations) \esolution)\|(?:Security Council esolution)\]\]( 1?\d{3}''')/g, '$1$2 $3$4');
	regex(/(''')(?:\esolution)\]\]( 1?\d{3}''')/g, '$1$2 $3$4');
	regex(/(after re(?:call|affirm)ing (?:all |)(?:previous |))(resolutions)(?= )/gi, '$1]');
	regex(/\\] \General)|Security Council)\|(?:General Assembly|Secretar(?:iat|y General)|Security Council)\]\]/g, ']');
     //post-nominals  
//	regex(/\\]/gi, '$1');
	regex(/(\]\] )\+|)\|(F?R\w{1,3})\]\]/gi, '$1$2');
     //professions  
//	regex(/\\]/gi, '$1');
	regex(/\\](?: politician|\\])/gi, ']');
	regex(/\\](?: politician|\\])/gi, ']');
	regex(/\\]( politician)/gi, ']');
	regex(/(British )\\]/gi, ']');
	regex(/\\]( politician)/gi, ']');
	regex(/\\]( politician)/gi, ']');
	regex(/\\]( politician)/gi, ']');
	regex(/\\]( politician)/gi, ']');
	regex(/\\]( politician)()/gi, ']$3');
	regex(/\\]/gi, '$1');
///piped links
	regex(/(\Secretary|SecretaryGeneral)|(?:GeneralSecretary|SecretaryGeneral) of the (?:U.N.|UN|United Nations))(\|)/gi, '$1Secretary-General of the United Nations$2');
	regex(/(\[\[)(?:(?:U.S.|US|United States) (?:Secretary of State)|(?:Secretary of State) of the (?:U.S.|US|United States))(\|)/gi, '$1United States Secretary of State$2');
	regex(/(\[\[)(?:(?:U.S.|US|United States|American) President|President of the (?:U.S.|US|U.S.A.|USA|United States(?: of America|)))(\|)/gi, '$1President of the United States$2');
	regex(/(\President|VicePresident of the (?:U.S.|US|U.S.A.|USA|United States(?: of America|)))(\|)/gi, '$1Vice President of the United States$2');
	regex(/\\](?=,? \[\[)/gi, '$1');
	regex(/\\](?=,? \[\[)/gi, '$1');
/// glossing fixes: wiktionary
    regex(/\\]/gi, ']');
    regex(/\\]/gi, ']');
    regex(/\\]( known )/g, 'simply$1');
    regex(/( known )\\]/g, '$1simply');
    regex(/\\]/gi, ']');
    regex(/\\] \\]/gi, '] professor');
    regex(/\\] \\]/gi, '] professor');
    regex(/\\]/gi, ']');
}
function Ohc_allcountries() {
 var	txt=document.editform.wpTextbox1;
//recognised sovereign states and a few unrecognised ones
//	regex(/\\]/gi, '$1');
	regex(/\xico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:Kingdom of the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Northern Ireland|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Per|Philippines|Poland|Portugal|Puerto Rico|Qatar|Romania|Russia|Rwanda|SADR|(?:Saint|St.?) Kitts (?:and|&) Nevis|(?:Saint|St.?) Lucia|(?:Saint|St.?) Vincent (?:and|&) the Grenadines|Samoa|San Marino|São Tomé (?:and|&) Príncipe|Saudi Arabia|Scotland|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|(?:South |)Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad (?:and|&) Tobago|Tunisia|Turkey|Turkmenistan|Turks (?:and|&) Caicos Islands|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Wales|Yemen|Zambia|Zimbabwe)\]\]/gi, '$1');
	regex(/\|the Philippines|Poland|Portuguese Republic|Russian Federation|Rwanda|Sahrawi Arab Democratic Republic|Federation of Saint Christopher (?:and|&) Nevis|San Marino|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovak Republic|Slovenia|Somalia|Somaliland|South Africa|South Ossetia|the Sudan|Suriname|China|Tajikistan|The Gambia|Togolese Republic|Trinidad (?:and|&) Tobago|Tunisia|Turkey|Uganda|Uzbekistan|Vanuatu|Yemen|Zambia|Zimbabwe)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/g, 'Republic of China');
	regex(/\xico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:Kingdom of the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Per|Philippines|Poland|Portugal|Puerto Rico|Qatar|Romania|Russia|Rwanda|SADR|(?:Saint|St.?) Kitts (?:and|&) Nevis|(?:Saint|St.?) Lucia|(?:Saint|St.?) Vincent (?:and|&) the Grenadines|Samoa|San Marino|São Tomé (?:and|&) Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|(?:South |)Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Timor Leste|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad (?:and|&) Tobago|Tunisia|Turkey|Turkmenistan|Turks (?:and|&) Caicos Islands|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)\|(]{3,39})\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); //piped to "language"
	regex(/\\]/g, 'US');
	regex(/\\]/g, 'UK');
	regex(/\\]/g, 'UN');
	regex(/\\]/gi, '$1');
//rem linking templates
//	regex(/\\]/gi, '$1');
	regex(/\{\{(\s?(?:flag|)country\s?|\s?flag\s?)\|/gi, '{{flagu|');
	regex(/\{\{\s?flag\s?\|(*(?:\|(?:19|20)\d{2}))\s?\}\}/gi, '{{flagu|$1}}');
	regex(/\{\{\s?flag\s?\|(*(?:\|\d\d?px))\s?\}\}/gi, '{{flagu|$1}}');
//country templates that deliver a linked mini flag icon
	regex(/\{\{(Austria|Chile|China|Algeria|Iraq|Italy|Japan|New Zealand|Philippines|Tunisia)\}\}/g, '{{Flagu|$1}}'); 
}
function Ohc_USstates() {
 var	txt=document.editform.wpTextbox1;
//US and Canadian states
//	regex(/\\]/gi, '$1');
	regex(/(\[\[Washington )\(U.?S.? state\)\|/gi, '$1(state)|');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
}
function Ohc_CommonTerms(){
 var txt=document.editform.wpTextbox1;
//	regex(/\\]/gi, '$1');
	regex(/\\]/g, 'US');
	regex(/\\]/g, 'UK');
	regex(/\\]/g, 'UN');
// Chained country links
//    regex(/\{\{\s?flag\s?\|/gi, '{{flagu|'); //disabled 4 Aug 2014
//	regex(/\{\{UK\}\}/g, 'United Kingdom');
	regex(/(\]\] in )\xico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:(?:Kingdom of |)the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Per|Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|SADR|(?:Saint|St.?) Kitts and Nevis|(?:Saint|St.?) Lucia|(?:Saint|St.?) Vincent and the Grenadines|Samoa|San Marino|São Tomé and Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|England|Scotland|Wales|Northern Ireland|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)\]\](?=,?*| and |\))/gi, '$1$2');
	regex(/(\]\](?:, | in ))\\](?=,?*| and |\))/gi, '$1$2');
	regex(/(\]\], )\xico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:(?:Kingdom of |)the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Per|Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|SADR|(?:Saint|St.?) Kitts and Nevis|(?:Saint|St.?) Lucia|(?:Saint|St.?) Vincent and the Grenadines|Samoa|San Marino|São Tomé and Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|England|Scotland|Wales|Northern Ireland|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)\]\](?=\.|*)/gi, '$1$2');
	regex(/(\]\], )\\](?=\.|*)/gi, '$1$2');
// Chained country links with typo
	regex(/(\]\], )\\](?=\.|*)/gi, '$1Philippine$2');
// Country/nationality 
//Link rationalisation
        regex(/(\]\], )\\](?:,? \\]|United Kingdom|UK)(?=\.|*)/gi, '$1$2');
//Nationalities egged to country
        regex(/\|Philippines?|Qatar|Romania|Russia|Rwanda|Sahrawi|Kittitian|(?:Saint|St.?) Lucia|Vincent|Samoa|San Marino?|São Tomé and Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spai?n|Sri Lanka|Sudan|Suriname|Swaziland|Swed|Syria|Taiwan|Tanzania|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad|Tobag|Tunisia|Turk|Tuvalu|Uganda|Ukrain|United Arab Emirates|United States|Uruguay|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)\]\](?=ese|(?:i?a|)n|ic?|ish)\b/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\gasque)\]\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\xic|Montenegr|Morocc)o\|\1(an)\]\]/gi, '$1$2');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\?\|(Swed(?:ish|es?))\]\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1'); //]
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/\\]/gi, '$1');
        regex(/(]\], )\\](?=|*)/gi, '$1$2');
        regex(/\\]/gi, '$1');
		regex(/\\](?= \[\[|\w)/gi, '$1$2');
		regex(/\]+)\]\]/gi, '$1');
// Country subdivisions
//	regex(/(\]\](?:, | in ))\\]/gi, '$1$2'); // Australian subdivisions
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2');
	regex(/(\|])/gi, '$1');	// China subdivisions
	regex(/(\\]))(?: Provinces?)/gi, '$1');	// China subdivisions
	regex(/(\]\](?:, | in ))\)\]\](?=,?*| and )/gi, '$1$2');	// China subdivisions
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2');
	regex(/\\] (in|of) \\]/gi, ']');
	regex(/(\]\](?:, | in ))\+province)\]\]/gi, '$1$2');
//	regex(/\\]/gi, '$1');
//	regex(/\parte?ments? (?:in|of) France)\|dparte?ment\]\]/gi, 'département');
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2'); //historical French provinces
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); // French subdivisions
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); 
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); 
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); // Spanish
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2');
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2');
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2');	// German subdivisions
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2');	// Indian subdivisions
	regex(/(\]\](?:, | in ))\Romagna|Apulia|Tuscany|Calabria|Sardinia|Liguria|Marche|Abruzzo|FriuliVenezia Giulia|TrentinoAlto Adige\/Südtirol|Umbria|Basilicata|Molise|Aosta Valley)\]\](?=,?*| and )/gi, '$1$2'); // Italian subdivisions
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); //South African provinces
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2'); 
	regex(/(\]\](?:, | in (?:the county of |)))\\](?=,?*| and )/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in (?:the county of |)))\\](?=,?*| and )/gi, '$1$2'); 
	regex(/(\]\](?:, | in (?:the county of |)))\\](?=,?*| and )/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in (?:the county of |)))\\](?=,?*| and )/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2');  // Irish subdivisions
	regex(/(\\]), \2shire/gi, '$1$2$3'); // rem shire for county capitals in English subdivisions
// Malaysian states
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2$3'); 	
// Brazilian states
	regex(/(\]\](?:, | in ))\\](?=,?*| and )/gi, '$1$2$3'); 	
	regex(/(\]\](?:, | in ))\tate|)\]\](?=,?*| and )/g, '$1$2$3'); 
// US States piped
//	regex(/\\]/gi, '$1');
	regex(/\\], \\]/gi, 'New York City');
	regex(/\\]/gi, '$1');
	regex(/\\](?:, New York|, \\]|)/gi, 'New York City');
//	regex(/New York(?: City), (?:New York|U\.S\.|USA?)/gi, 'New York City');
	regex(/\\], \\]/gi, '$1, California');
	regex(/\]{1,30})\]\]/gi, '$1');
//	], ] -> ]
//	regex(/\]*), (]*)\|\1\]\],(?:\2|\\])/gi, ']'); //disabled, changing over to piped city only
	regex(/(\]*), (]*)\|\2\]\],)\\]/gi, '$1$3'); //piped city + unlinked state
//	regex(/(\]{1,20}\,\s(?:AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming))\|(?:]{1,20})\]\]\,?\s\\]/gi, '$1]]');
//	], ] -> ]
	regex(/(\]{1,20})\,\s(?:Georgia|Washington)\|(?:]{1,20})\]\]\,?\s)\\]/gi, '$1$2');  //piped city only (no state)
	regex(/(\\]/gi, '$1]], $2');
//regex that turns city links into piped city links
	regex(/(\\]/gi, 'Cobh]], $1');
//disabling 19 June 2011
	regex(/\\]/gi, ']');
	regex(/\\]/gi, '$1');
	regex(/(\\])/gi, '$1$3$2'); //Lyon spelt without 's'
	regex(/\lede|)France\]\]/gi, '$1');
	regex(/(Paris|\\]),\s(?:ledeFrance|\ledeFrance\]\])/gi, '$1');
	regex(/(\])/gi, '$1, $2$3'); //direct link is not parenthetical
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\\])/gi, '$1$3$2'); 
	regex(/(\]{1,20}))\,\s(Canada|China|France|Germany|(?:Northern |)Ireland)\]\]/gi, '$1]], $2');
	regex(/(\]{1,20})\,\s(England|Scotland|Wales))\]\]/gi, '$1|$2]], $3'); // pipe trick disabled
	regex(/(\\])(, France)/gi, '$1$3$2'); //reinstate ambiguous link
//	regex(/(\\])(, Scotland)/gi, '$1$3$2'); //reinstate ambiguous link
//	regex(/(\\])(, England)/gi, '$1$3$2'); //reinstate ambiguous link
	regex(/(\\])(, Germany)/gi, '$1$3$2'); //reinstate ambiguous link
//	], ] -> ], Massachusetts
	regex(/(\\]),?\s\\]/gi, '$1, $2');
	regex(/(\\]),?\s\\]/gi, '$1, $2');
//	unpipe unique US city names (articles without state disambiguators)
	regex(/(Atlanta|Baltimore|Boston|Chicago|Cincinnati|Cleveland|Dallas|Denver|Detroit|Honolulu|Houston|Illinois|Indianapolis|Kansas|Las Vegas|Los Angeles|Miami|Milwaukee|Minneapolis|Minnesota|New Orleans|New York|Oklahoma City|Philadelphia|Pittsburgh|Salt Lake City|San Antonio|San Diego|San Francisco|Seattle|St. Louis|Virginia Beach), (?:California|Colorado|Florida|Georgia|Hawaii|Illinois|Indiana|Louisiana|Maryland|Massachusetts|Michigan|Minnesota|Ohio|Oklahoma|Pennsylvania|Texas|Utah|Washington)\|(\1)\]\]/gi, '$1]]');
	regex(/\\]/gi, '], $2');
//rem excess "California, US" from Hollywood and LA
	regex(/(Hollywood|Los Angeles)(?:, California(?:, U\.S\.(?:A\.)?|, USA?|))(?!\])/gi, '$1, California');
//	regex(/\//Canada
//	regex(/\]{1,20})\,\s(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\|\1\]\]\,?\s\\]/gi, ']');
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2');	// Canadian subdivisions
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2');	// Canadian subdivisions
	regex(/(Barrie|Calgary|Chicoutimi|Edmonton|Guelph|Kelowna|Moncton|Montreal|Oshawa|Ottawa|Quebec City|Saskatoon|Sherbrooke|St. Catharines|Thunder Bay|Toronto|Trois-Rivières|Vancouver|Winnipeg), (?:Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\|(\1)\]\]/gi, '$1]]');
	regex(/\\]/gi, '$1');
	regex(/(\\w*)(?:\|(?:Down|Mid)town)\]\] (?:\\]|\2)/gi, '$1$2]]');
	regex(/\\]/gi, 'Sydney');
	regex(/\\], (?:\\]|(?:Australia|New South Wales|NSW))/gi, 'Sydney');
	regex(/\]{1,30})\]\]/gi, '$1');
	regex(/(\\], (?:\\]|Victoria)/gi, '$1]]');
	regex(/\\]/gi, ']');
    regex(/(\\], (?:\\]|Merseyside)/gi, '$1]]');
	regex(/\\], \\]|)/gi, '$1, England');
	regex(/(London, England), (?:UK|United Kingdom)/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\+|)\]\]/gi, '$1$2');
	regex(/\|Bombay|Brisbane|Canberra|Frankfrt|Kyoto|Mexico City|Madrid|Munich|New\sDelhi|Osaka|Ottawa|Florence|Stuttgart|Vienna)(, +|)\]\]/gi, ']$2');
	regex(/\\], \\]|)/gi, '], Italy');
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/(\\]/gi, '$1]]');
	regex(/(\\]/gi, '$1]]');
	regex(/(Toronto|\\]), \\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
//	regex(/\]{3,30})\]\]/gi, '$1');
//	regex(/(], (?:UK|United Kingdom)), (?:UK|United Kingdom)/gi, '$1'); 
	regex(/(\+)(, (?:Birmingham|Bristol|Derry|Edinburgh|London|Liverpool|Manchester)))\]\]/gi, '$1|$2]]$3'); // pipe trick disabled
//chained cities Europe
	regex(/(\]\](?:, | in ))\\]/gi, '$1$2$3'); 
//chained cities -Europe
	regex(/(\]\](?:, | in ))\sseldorf|Edinburgh|Frankfurt|Geneva|Hamburg|Helsinki|Leipzig|Lisbon|Madrid|Milan|Munich|Oslo|Prague|Rome|Salzburg|Stockholm|St. Petersburg|Madrid|Nice|Venice|Vienna|Zurich)\]\]/gi, '$1$2'); 
//chained cities -S. America
	regex(/(\]\](?:, | in ))\xico) City|Quito|So Paolo|Santiago|Sucre)\]\]/gi, '$1$2'); 
//ambiguous
	regex(/\\]/gi, '$1');
//continents and regions
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\]*)\]\]/gi, '$1');
// Country and language; city
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ation|)\||)((?:rural|(?:sub|)urban)(ied?|iation| area|))\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	//Linking template - outright removal of {{lang-en}}
	regex(/\{\{lang(?:-|\|)en\|(*?)\}\}/gi, '\'\'$1\'\'');
	regex(/(\{\{lang-(?:de|es|fr|ru|zh)\|)(*?\}\})/gi, '$1link=no|$2');
	//top 7
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '] ($2)');  //rem per 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'US');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'UK');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
    regex(/\xican(?:s| people)\||)(Mexican)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');		//unpiped
//dab – removing unsuitably piped links
	regex(/(\[\[)director \(film\)\|/gi, '$1');
//time and seasons
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\|month|(?:fort|)night|season(?:al|)|hour|minute|present|second|week|year|decade|century)(?end|ly|s|)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
    regex(/\\]/gi, '$1');
// months
	regex(/\\]/gi, '$1');
	regex(/\]{1,30})\]\]/gi, '$1');
	regex(/\|\w+)(?:th|st|nd) century)\|(]+?)\]\]/gi, '$1'); 	
	regex(/\|\w+)(?:th|st|nd) century)\]\]/gi, '$1');
// simple words and numbers	
	regex(/\\]/gi, '$1');
// expressions in foreign languages	
	regex(/\\]/gi, '$1');
//Chinese language linked template
//	regex(/\{\{linktext\|(+)\|(+)\|(+)\|(+)\|(+)\|(+)\}\}/gi, '$1$2$3$4$5%6'); //linktext 6 parameters
//	regex(/\{\{linktext\|(+)\|(+)\|(+)\|(+)\|(+)\}\}/gi, '$1$2$3$4$5'); //linktext 5 parameters
//	regex(/\{\{linktext ?(?:\|lang=zh(?:-han ?)|)\|(+)\|(+)\|(+)\|(+))}\}/gi, '$1$2$3$4'); //linktext 4 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han ?)|)\|(+)\|(+)\|(+)\}\}/gi, '$1$2$3'); //linktext 3 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han ?)|)\|(+)\|(+)\}\}/gi, '$1$2'); //linktext 2 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han ?)|)\|(+)\}\}/gi, '$1'); //linktext 1 parameter
	regex(/(\{\{zh\|=(?:+))(\}\})/gi, '$1|link=no$2'); 
// proper nouns
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
//	regex(/\\]/g, '$1'); 
// adjectives
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
// people general, professions
//	regex(/\\]/gi, '$1');
	regex(/\?stylist))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/g, 'consul general');
	regex(/\\]/g, 'legislative council');
	regex(/\chancellor\||)(vicechancellor)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ |)jockey|drawing|(?:music(?:al|) |)educator|lite|embassy|engineer(?:ing|)|exhibition|experts?|explorer|fishing|group|guest star|hacker|(?:band ?|)leader|librar(?:ian|ie|y)|lyricist|mayor|mathematic(?:al|ian)|merchant|mercenary|monument|music(?:al(?: theatre|theater|)|ian|)|(?:multi-|)instrumentalist|narrator|orator|panorama|playwright|postage(?: stamp|)|postman|produc(?:e|tion)|pseudonym|(?:political |civil |)(?:activist|commentator|dissident)|(?:record |publishing |)company|publicist|sailor|sculpt(?:or|ure)|soldier|solicitor|singer.songwriter|song|(?:motivational |public |)speaker|(?:stock|)broker|toy|tradition|trainee|trumpet(?:er|)|waiter)(s|)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|)writ(?:er?s?|ten|ing)|sing(?:er|ing))\]\]/gi, '$1');
	regex(/\inchief|editorial|reporter|journaliss?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?writ(?:ers?|ing))\]\]/gi, '$1');
	regex(/\\]/gi, 'screen$1');
	regex(/\\]/gi, ']');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'politician');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|ement|ing))\]\]/gi, '$1');
	regex(/\ivil\service\||)(?:ivil\serv(ants?|ice))\]\]/g, 'civil serv$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\*\)|)\||)(captain|colonel|major|general|lieutenant|sergeant|private)\]\](?= \[)/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/(British )(\\])/gi, '$2$1$4'); //retraining in necessary order
	regex(/\s?|y|)|dance?|dancing)\]\]/gi, '$1'); 
	regex(/\?|dancing))\]\]/gi, '$1'); 
	regex(/\int|writ)ing|illustration)\||)(pint|writ|illustrat)(ed|rs?|ings?)\]\]/gi, '$1$2'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); //false positive for 'Vans' clothing brand
//	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/(\W\s+)\\]/gi, '$1$2');
//business & legal
//	regex(/\\]/gi, '$1');
	regex(/\|)chair(?:man|woman|person|))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|)president)\]\]/gi, '$1');
	regex(/\|)president|realestate(?: broker| agent|)|regulation|taxe?|taxation|trademark|treasurer)\]\]/gi, '$1');
	regex(/\e?|tive council|ture))\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\n| executive| ?person|es|)|corporate executive)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\?)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, 'd$1'); 
	regex(/\?making\||)(film?mak(?:ers?|ing))\]\]/gi, '$1'); 
	regex(/\?|ement|ing|ers?))\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\held|) |public |listed |quoted )compan(?:ies|y))\|(private|public|listed|quoted)\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\O|C\.\.O\.|chief (financial|operating) officer)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\?|ions?))\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
    regex(/\\]/gi, '$1'); 
// buildings structure and environment	
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ade|floor|furniture|garden(?:ing|)|hospital|home|residen(?:ce|t)|otel|hous(?:e|ing)|infrastructure|landmark|museum|neighbou?rhood|night club|park|roof|shop(?:ping mall|ping arcade|)|stadium|store?y|skyscraper|interior design(?:er|))\]\]/gi, '$1');
	regex(/\]+)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\?rise)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?town)\]\]/gi, '$1');
    regex(/\?town)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|)))\]\]/gi, '$1');
//	regex(/\\]/gi, '$1');
// earth science nouns 
	regex(/\\]/gi, '$1');
	regex(/\\](?!)/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\n)\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); //WP:EGG
	regex(/\\]/gi, '$1');
	regex(/\eight)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|ing))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
// tech
	regex(/\\]/gi, '$1');
	regex(/\?phone|MP player|digital audio player|technology|(?:computer |)(?:application|hardware|program|software)|(?:computer |video |)game)\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
// economy
//	regex(/\\]/gi, '$1');
	regex(/\s?|ment)|GDP|gross domestic product|inflation|insurance|interest(?: rate|)|invest(?:ed|ing|ments?|ors?)|joint ventures?|loan|money|mortgage|per capita(?: income|)|(?:labou?r |trade |)union(?:ist|)s?|utilities)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\time\||)((?:full|part)time(?: employment| job| work|))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\n|sell(?:er|ing|s|)|sold)\]\]/gi, '$1');
	regex(/\?town|fire|flowers|gambling|gas(?:oline|)|heating|ice|income|information|institut(?:e|ion)|inventor|jobs?|lie|magazines?|mosque|(?:news|)papers?|prizes?|publicity|organi(?:e|ation)|department|petrol|plastic|(?:air |)pollution|product|salary|school|smog|subsidiar(?:y|ie)|supermarket|synthesier|synagog(?:ue|)|team|television|(?:tv |television |)network|temple|textile|time(?:line|)|wage|water|website|win)(s|)\]\]/gi, '$1$2'); 
	regex(/\\]/gi, '$1');
	regex(/\?)|market(?:ing|)|sign(?:age|))(s|)\]\]/gi, '$1$2');
	regex(/\\]/g, '$1'); 	//'Logos' is a separate word from logo
	regex(/\\]/g, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/g, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|gration))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/( *)\?|ing))\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ation\||)(non-?profit\sorganiations?|non-?profit)\]\]/gi, '$1');
	regex(/\ation\||)(non-?(?:governmental|profit)\sorganiation|NGO)\]\]/gi, '$1');
	regex(/\ation)\||)(charitable\sorganiations?|charit(?:able|ies|y))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
// weather and climate
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ius\||)((?:(?:degree|°)?\s?(?:\s|-|&nbsp)|)Celsius)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\)\]\]/gi, '$1'); //delink temperature in redirect
//delink full temperature in redirect
	regex(/\ius|Fahrenheit|C|F)\|(]+?)\]\]/gi, '$1');
	regex(/(\d)(?:\s|-|&nbsp|)(degree|°)(?:\s|-|&nbsp|)\ius|Fahrenheit|C|F)\|(C|F)\]\]/gi, '$1&nbsp;$2$3');
// measurements and perception
//	regex(/\\]/gi, '$1');
	//Template:{{convert}}, {{height}}
//delink within convert template: optional square and cubes; optional per unit time; optional range
	regex(/(\{\{convert\|+?(?:\|(?:to|by|and|-))?(?:\|+?)?\|(?:(?:sq|cu)?(?:ins?|ft(?:in|)|yds?|mi|?m)?)(\/(?:s|sec|min|h))?(?:\|(?:sq|cu)?(?:in|ft(?:in|)|yds?|mi|?m)?(\/(?:|min))?)?(\|\d)?(\|(?:sp|adj|abbr|disp|sigfig|sortable)=+?)*)\|lk=(?:on|in|out)/gi, '$1');
//delink within convert template: where square and cubes make no sense;optional per unit time; optional range
	regex(/(\{\{convert\|+?(?:\|(?:to|by|and|-))?(?:\|+?)?\|(?:acres?|ha|kgs?|lbs?|hp|?w|°?|mph)(\/(?:|min))?(?:\|(?:acre|ha|kg|lb|hp|?w|°?|mph)(\/(?:|min))?)?(\|\d)?(\|(?:sp|adj|abbr|disp|sigfig|sortable)=+?)*)\|lk=(?:on|in|out)/gi, '$1');
//delink non-metric units: optional square and cubes; optional per unit time
	regex(/\|square|sq|cubic|cu)?\s?(?:milli|centi|kilo|)met(?:er|re)s?)\]\]/gi, '$1');
	regex(/\|square|sq|cubic|cu)?\s?(?:milli|centi|kilo|)met(?:er|re)s?\|(]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/(\{\{pop\sdensity\s(?:km2|mi2)to\s(?:km2|mi2)*?)\|\s?wiki=(?:yes|no)/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
// colours
//	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\y|green|maroon|orange|pink|purple|red|violet|white|yellow)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1$2');
	regex(/\y)\]\]/gi, '$1');
	regex(/\]* \(colou?r\)\|(]*)\]\]/gi, '$1');
	regex(/\+\|)(\w+)\]\]/gi, '$1');
// geo-politics
//chained US state governors
	regex(/(\]{1,20})of(?:Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming)\|]{1,20})\]\](?:of the (?:U\.? ?S\.? |)state |)of\\]/gi, '$1 of $2]]');
	regex(/(\]{1,20})of(?:Georgia|Washington)\|]{1,20})\]\](?:of the (?:U\.? ?S\.? |)state |)of\\]/gi, '$1 of $2]]');
//chained office-holders
//	regex(/\\]/gi, '$1');
	regex(/\|)President) of (]+)\|\1\]\] of \\]/gi, ']');
	regex(/\]+)\|\1\]\]\2(?:\\]|\3)/gi, ']');
	regex(/\|(?:the |)Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|(?:Saint|St.?) Kitts and Nevis|(?:Saint|St.?) Lucia|(?:Saint|St.?) Vincent and the Grenadines|Samoa|São Tomé and Principe|Saudi Arabia|Senegal|Serbia|Seychelles|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Korea|South Ossetia|Spain|Sri Lanka|Sudan|Suriname|Sweden|Syria|Tajikistan|Tanzania|Thailand|Tonga|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|(?:the |)United Kingdom|Uzbekistan|Vanuatu|Vietnam|Western Sahara|Yemen|Zambia|Zimbabwe)\|((?:* |)(?:Agriculture|Commerce|Defene|Education|Employment|Energy|Foreign|Health|Labou?r|Prime|Interior|Trade|Transport|Treasury|Finance) minister)\]\](,? \[\[)/gi, '$1$2');
	regex(/\\](,? \[\[)/gi, '$1$2');
	regex(/\\](,? \[\[)/gi, '$1$2');
	regex(/\\](,? \[\[)/gi, '$1$2');
	regex(/\\](,? \[\[)/gi, '$1$2');
	regex(/\\](,? \[\[)/gi, '$1$2');
	regex(/\\}]+\|(]*President]*)\]\](,? \[\[)/gi, '$1$2');
//	regex(/\+\|(]*Prime minister]*)\]\](,? \[\[)/gi, '$1$2'); //deactivated 17/3/17 due to false positive in Mark Rutte article
	regex(/\|]+\|(|]+minister)\]\](,? \[\[)/gi, '$1$2');
	regex(/\\] \\]/gi, ']');
	regex(/(Irish) \\]/gi, ']');
//	regex(/\\]/gi, '$1$2');
//	regex(/\|U..|United States|)( army| armed forces| navy| air force)\]\]/gi, '$1$2');
	regex(/\e|passport|propaganda)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]*)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|nts?))\]\]/gi, '$1');
	regex(/\tat|)|crop|currenc(?:y|ie)|defection|dollar|drugs?|(?:by-|general |re-|)election|espionage|freelance|federation|(?:central |local |municipal |)government|heroin|ideolog(?:ie|y)|incumbent|independence|marine|coal|oil|parliament|petroleum|people|polic(?:ie|y)|population(?: density|)|(?:political |economic |super|)power|liberal|reform|regiment|republic|revolution|(?:civil |)war|worker|world(?:?wide|)|pound|veto|yen|yuan)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\force|armed forces|army|navy|defene)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|ion))\]\]/gi, '$1');
	regex(/\ation)\||)((?:de-?|post-|)industr(?:y|ial(?:ists?|)|iali(?:ation|e)))\]\]/gi, '$1');
	regex(/\?|ation|ee))\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\ation|ialism|ies|y))\]\]/gi, '$1');
//	regex(/\s?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]{8})\]\]/gi, '$1');
	regex(/\\]\$?/gi, 'A$');
	regex(/\\]\$?/gi, 'NZ$');
	regex(/\\]/gi, '$1'); 
	regex(/\|USD|)(]*)\]\]\]\]/gi, 'US$$1');
	regex(/\]+?)\]\]\$/gi, '$1');
	regex(/\)\]\]?/gi, '$1');
	regex(/\\]\$?/gi, '$1');
	regex(/\|)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/g, 'UN');
	regex(/(?:United Nations|UN|U\.N\.|UNO|U\.N\.O\.) \\]/g, ']');
	regex(/\\]/g, ']');
	regex(/\\]/g, '$1');
//	regex(/\\]/g, '$1');
	regex(/\\]/g, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/g, 'EU');
	regex(/\\]/gi, '$1$2');
	regex(/\|)President)\]\]/gi, '$1');
	regex(/\|)President of the United States\|(]{5,30})\]\]/gi, '$1');
//sociology, race & education
//	regex(/\\]/gi, '$1');
	regex(/(?:\\])(?= ?\[\[|\n)/gi, 'His Excellency');
	regex(/(?:\\]|Sri) (?=\[\[)/gi, '');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\?|ing)|person|people|educators?|instructors?|intellectuals?|scholar(?:ships?|s?)|teach(?:ers?|ing)?|head(?:masters?|mistress| teachers?)|society|sociology|students?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/(?:\\]) year/gi, 'first year');
	regex(/(?:\\]) year/gi, 'second year');
	regex(/\?|ion|ing))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\||)((?:political |social |)activis)\]\]/gi, '$1');
	regex(/\?|ion|ional)|health?care)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|god?|grand?|step?|)(family|father|mother|parent|cousin|twin)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1$2$3');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|)(?:aunt|uncle|niece|nephew)(?:s|))\]\]/gi, '$1');
	regex(/\\]/g, '$1');
	regex(/\\]/g, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/g, '$1');
	regex(/\\]/g, '$1');
	regex(/\\]/gi, '$1');
	regex(/\*?|)\|(professional)\]\]/gi, '$1');
	regex(/\illionaires?|class|investor|(?:land|property)-?owner|poor|poverty(?: line|)|public figure|rich|socialites?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|y))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\{2}|far|)(?:left|right)(?:wing|) politics\||)((?:cent{2}|far|)(?:left|right)(?:wing|))\]\]/gi, '$1');
	regex(/\)(left|right)\]\]/gi, '$1$2$3');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\s)\]\]/gi, '$1');
	regex(/\?s degree|honorary degree)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, 'PhD');
	regex(/\\]/gi, '$1');
	regex(/\\]/g, 'MBA');
//	regex(/\\.?{,3})\]\]/g, '$1');
//	regex(/\\w*)\|()\.(\w*)\.\]\]/g, '$1$2');
	regex(/\\]/gi, 'honorary $1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
//	regex(/\\]/g, ']'); //retraining
	regex(/(\]{1,26}\,\s(?:Cambridge|Oxford|London)\|(?:]{1,26} College)\]\])\,?\s\\]/g, '$1, $2');
	regex(/(\]{1,26}\,\s(Cambridge|Oxford|London))\|(?:]{1,26} College)\]\]\,?\s\\]/g, '$1]]');
//	regex(/\\]/g, ']'); //retraining
	regex(/\]{1,26})\,\s(Cambridge|Oxford|London)(\sUniversity|)\|(]{1,26})\]\]\,?\s\\]/g, ']');
	regex(/\\]/g, ']');
// lifestyle & religion
//	regex(/\\]/gi, '$1');
	regex(/\?style)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|cake|cheese|fast food|fat|modern|nutrition|restaura(?:nt|teur)|smoking|soft drinks?|wine)\]\]/gi, '$1');
	regex(/\ation\||)(modern(?:ie?|iation))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\s?|tour guide)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|secular|sex|slang|travel)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\] (gay|lesbian)/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, ']');
	regex(/\\] \\])/gi, '[[$1$2');
	regex(/\\] \\])/gi, '[[$1 Jews|$1 $2');
	regex(/\\])( Jews?)/gi, '[[$1$3$2');
//	regex(/\\]/gi, ']');
	regex(/\\] \slm])\||)(islam|mslm]s?)(is|)\]\]/gi, ']$3');
	regex(/\\] \slm])\||)((?:islam|mslm])s?\]\])/gi, '[[$1 Islam|$1 $2');
	regex(/\\])( islam)/gi, '[[$1$3$2');
	regex(/(\[\[Bishop )\((?:Roman |)Catholic(?:ism| church)\)\|/gi, '$1(Catholicism)|'); //repiping
	regex(/\[\[(?:Roman |)Catholic (?:Arch|)Bishops?\|/gi, '[[Bishop (Catholicism)|'); //repiping
	regex(/\\] (\\])/gi, '$2$1 $3');
	regex(/(\\]( (?:of|in) the )\\])/gi, '$1$2$3');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
    regex(/(?:\\]|Church of England) \\]/gi, ']');
    regex(/(?:\\]|Anglican) \\]/gi, ']');
    regex(/(\| ?architectural type ?= ?)(Church)\|/gi, '$1]|');
	regex(/\\]/gi, '$1');
	regex(/\n|pastor|prayer|preacher|priest)(s|)\]\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
//	regex(/\\]/gi, '$1'); //temporary disabling for work on church articles
	regex(/\\]/gi, ']');
	regex(/\\]/gi, ']');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?|ing))\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\e| certificate|))\]\]/gi, '$1');
	regex(/\{\{n(e|)\}\}/gi, 'né$1'); //rem née template
//	regex(/\{\{n(e|)\|(+)\}\}/gi, 'né$1 $2'); //rem née template with parameter
	regex(/\\]/gi, '$1');
	regex(/\\]/g, '$1');
// biology, medical, crime
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ection|therapy|treatment)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?gun|rifle)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\ail|execution|firing squad|jury|parole)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\n|e officers?|ing|e?|e station))\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
//music & media
//	regex(/\\]/gi, '$1');
    regex(/\\]/gi, 'simply');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
    regex(/\\]/gi, 'simply');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]*)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\n|person|models?))\]\]/gi, '$1');
	regex(/\|super?|)models?|modell?ing)\]\]/gi, '$1');
	regex(/\\sjockey\|(]{1,15})\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\s?|s|)|visual)(?: art(?:ist|)s?|))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'biographical film');
	regex(/\\]/gi, '$1');
//	regex(/\\]/gi, '$1');
	regex(/\?off)\]\]/gi, '$1');
	regex(/\?mak(?:er|ing|)|broadcast(?:ing|)|comedy|documentar(?:y|ies)|drama|episode|pen.name|live.action|new|play|plot|prime?time|science.fiction|sci-fi|short film|special effects|stage|spin?off|stage.name)\]\]/gi, '$1');
	regex(/\s?|ment|s?)|show.?(?:biz|business))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\*?)documentary)\]\]/gi, '$1');
	regex(/\*?))\]\]/gi, '$1');
	regex(/\*?)documentary\s(*?))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1'); 
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1$2');
	regex(/(\refecture\]\])/g, '$1:$2');
	regex(/\*?))\]\]/gi, '$1');
  // rem piped music & media
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1'); 
	regex(/\?com|situation comedy)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1'); 
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\?|)series|show)(s|))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]*?\s?)((?:television|tv) (?:series|films?|shows?|program(?:me|)s?|sitcom))\]\]/gi, '$1$2');
	regex(/\]+?)\]\]/gi, '$1');
    regex(/(?:\\]|British) \\]/gi, ']');
//	regex(/\]+?)\]\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\|CD|C\.D\.)(?: single|))\]\]/gi, '$1');
	regex(/\\|(?:CD|C\.D\.)(s|)\]\]/gi, 'CD$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/(\])/gi, '$1$2$3');
	regex(/\\]/gi, '$1');
	regex(/\]+?) guitar\|((?:bass|electric|lead|rhythm)(?:\sguitar|))\]\]/gi, '$1');
	regex(/\]+?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?kit|drummer)\||)(drums?|drum ?kits?|drumming|drummers?)\]\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
// other musical instruments inside infoboxes
	regex(/(\|*?nstrument*=*)\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\](?:(*)\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\]|)(?:(*)\]+?\||)(]+?)\]\]|)(?=*?\|)/gi, '$1$2$3$4$5$6$7$8$9$10');
	regex(/(\|*?nstrument*=*)\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\](?:(*)\]+?\||)(]+?)\]\](*)\]+?\||)(]+?)\]\]|)(?:(*)\]+?\||)(]+?)\]\]|)(?=*?\|)/gi, '$1$2$3$4$5$6$7$8$9$10'); //repeat
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1'); //disabled unlinking of "arrangement"  24/10/2020
	regex(/\\]/gi, '$1');
	regex(/\?s?))\]\]/gi, '$1');
	regex(/\?s?))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
// literary
//	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?up |)comedy\||)(?:stand?up |)(comedy|comedies|comic|comedians?|comediennes?|stand?up)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\s?|tic|try))\]\]/gi, '$1');
	regex(/\?seller\||)(best?sell(ers?|ing))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/Print \(Hard(back|cover) (&|and) Paperback\)/gi, 'Print (hardback and paperback)');
	regex(/Print \(Hard(back|cover)\)/gi, 'Print (hard$1)');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'non-fiction');
	regex(/\stor(?:ies|y)|suspense|thriller|trilogy)\]\]/gi, '$1');  
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, 'author');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\r)\||)((?:interpret|translat)(?:ion|ing|rs?))\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\?telling\||)(story?teller)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1$2');
// sport
//	regex(/\\]/gi, '$1');
	regex(/\]+?\||)(association football|soccer)\]\]/gi, '$1');
	regex(/\[(football \(soccer\)|soccer)\|/gi, '[association football|');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\[midfield(?:er|)\((?:(?:association |)football|soccer)\)\|/gi, '[midfielder');
	regex(/\\] (\\])/gi, '$2$1 $3');
	regex(/\\] \\]/gi, ']');
	regex(/\\] (\\])/gi, '$2$1 $3');
	regex(/\\] (\\])/gi, '$2$1 $3');
	regex(/\|coaching|manager)\]\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
//	regex(/\\]/gi, '$1');
//	regex(/\\]/gi, '$1'); 
	regex(/\ms?)\]\]/gi, '$1'); 
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
	regex(/\\]/gi, '$1');
//	regex(/\\]/gi, '$1'); //disabled 1 July 2021
    regex(/\Hand(ed|) Bat(?:smn)?)\]\]/gi, 'Right-handed');
    regex(/\Hand(ed|) Bat(?:smn)?)\]\]/gi, 'Left-handed');
    regex(/\*)\]\]/gi, '$1');
    regex(/(\reak\|/g, '$1leg break|');
    regex(/(\pin\|/g, '$1off spin|');
    regex(/(\reak\|/g, '$1off break|');
    regex(/(\arm(*\]\])/gi, '$2-arm $1$3');
    regex(/(\owling\|Fastedium/g, '$1fast bowling|fast–medium');
    regex(/(\owling\|Fast/g, '$1fast bowling|fast');
    regex(/(\owling\|MediumFast/g, '$1fast bowling|medium-fast');
    regex(/(\owling\|Medium/g, '$1fast bowling|medium');
    regex(/(\owling\|Spin/g, '$1spin bowling|spin');
//full dates
	regex(/\\]-\\d-\d)\]\]/gi, '$1-$2');
	regex(/(\d{3})-\\d-(?:\d|30|31))\]\]/gi, '$1-$2');
//	regex(/\\]/gi, '$1');
	regex(/\?\d|30|31)(?:th|st|nd|rd|)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1 $2');
	regex(/\?\d|30|31)(?:th|st|nd|rd|)\]\]/gi, '$1 $2');
}
/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION
var linkmap=;
function ohc_protect_refs()
{
	// protects links within ref sections
	// the sensitive part is stored and replaced with a unique identifier,
	// which is later replaced with the stored part.
	var protect_function = function(s, begin, replace, end) {
		linkmap.push(replace);
		return begin + "⍌"+(linkmap.length-1)+"⍍" + end;
	};
//\|x=
	regex(/(<ref*?>)(*)(<\/ref>)/gi, protect_function);	
	regex(/(\{\{(?:cit+)\|)(*)(\}\})/gi, protect_function);	
	regex(/(\{\{s-(?:aft|bef|ttl)\|)(*)(\}\})/gi, protect_function);	
}
function ohc_unprotect_refs()
{
	//unprotect all dates
	regex(/⍌(+)⍍/g, function(x, n) {
		var res = linkmap;
		res = res.replace(/⍌(+)⍍/g, function(x, n) {
			var res = linkmap;
			res = res.replace(/⍌(+)⍍/g, function(x, n) {
				var res = linkmap;
				res = res.replace(/⍌(+)⍍/g, function(x, n) {
					return linkmap;
				});
				return res;
			});
			return res;
		});
		return res;
	});
}
/** ------------------------------------------------------------------------ **/
function Unlink_second() {
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]({0,10000})\\]({0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2$4$2$5$2$6$2'); //remove duplicated links 
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]({0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2$4$2$5$2'); //remove duplicated links (second pass)
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]({0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2$4$2$5$2'); //remove duplicated links (second pass)
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2$4$2'); //remove duplicated links (third pass)
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2$4$2'); //remove duplicated links (third pass)
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2'); //remove duplicated links (third pass)
	regex(/(\|]+)\]\]+\\]{0,10000})\\]({0,10000})\\]/gi, '$1$2$3$2'); //remove duplicated links (third pass)
}
function Unlink_all() {
	regex(/\|]*)\|)?(|]*)\]\]/gi, '$1'); //simplify overcomplication
	regex(/\|]{,9})\]\]/gi, '$1');
}
function Ohc_countries(e) {
    e.preventDefault();
    Ohc_allcountries();
    ohc_unlinkflag();
//  Ohc_COMMON_edit_summary();
}
function Ohc_USstates_driver(e) {
    e.preventDefault();
	Ohc_USstates();
}
function Unlink_all_driver(e) {
    e.preventDefault();
	Unlink_all();
}
function Unlink_second_driver(e) {
    e.preventDefault();
	ohc_protect_refs();
	Unlink_second();
	ohc_unprotect_refs();
}
function Ohc_COMMON(e) {
    e.preventDefault();
    Ohc_retrain_links();
    Ohc_CommonTerms();
    Ohc_COMMON_edit_summary();
}
function Ohc_COMMON_edit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); 		
	setreason('per ]', 'append');
	doaction('diff');
}
/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/TemplateScript
 */
// <pre>
if ($.inArray(mw.config.get('wgAction'), ) !== -1) {
	$.ajax(
		'//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js',
		{dataType: 'script', cache: true}
	).done(function () {
		$.when(
			mw.loader.using(),
			$.ajax('//en.wikipedia.org/search/?title=User:Ohconfucius/script/MOSNUM_utils.js&action=raw&ctype=text/javascript',
				{dataType: 'script', cache: true}),
			$.ready
		).done(function () {
			var add = function() {
            return mw.util.addPortletLink.apply(mw.util, arguments);
			};
			$(add('p-tb', '#', 'DATES to dmy', 'dmy-unitfixer', 'Align all dates to dmy', '', '')).click(ohc_all_to_dmy_driver);
			$(add('p-tb', '#', 'DATES to mdy', 'mdy-unitfixer', 'Align all dates to mdy', '', '')).click(ohc_all_to_mdy_driver);
//			$(add('p-tb', '#', 'Expand ref dates', 't-expandref', 'Expand month names within refs', '', '')).click(ohc_expand_ref_dates_driver);
//			$(add('p-tb', '#', 'Expand all dates', 't-expandall', 'Expand month names throughout', '', '')).click(ohc_expand_all_dates_driver);
			$( add('p-tb', '#', 'US-slash dates', 't-US', 'US-slash', '', '') ).click(ohc_US_slash_dates_driver);
			$( add('p-tb', '#', 'UK-slash dates', 't-UK', 'UK-slash', '', '') ).click(ohc_UK_slash_dates_driver);
			$( add('p-tb', '#', 'Delink COMMON terms', 't-commonterms', 'Removes links to common terms', '', '') ).click(Ohc_COMMON);
			$( add('p-tb', '#', 'Delink all COUNTRIES', 'ct-countries', 'Removes links to country articles', '', '') ).click(Ohc_countries);
			$( add('p-tb', '#', 'Unlink US states', 'ct-51 states', 'Removes links to US states', '', '') ).click(Ohc_USstates_driver);
			$( add('p-tb', '#', 'Remove all LINKS', 'ct-ALL-Links', 'Nukes all links -problematic sections only', '', '') ).click(Unlink_all_driver);
			$( add('p-tb', '#', 'Remove SECOND links', 'ct-SECOND-Links', 'Nukes all second links', '', '') ).click(Unlink_second_driver);
		});
	});
}
// </syntaxhighlight>