Jump to content

User:Ohconfucius/test/Common Terms.js

From Wikipedia, the free encyclopedia
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 Wikipedia: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|S[UW]I|Switzerland)|CHE|S[UW]I)(\|[^{}]+|)\}\}/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[RW]|Curaçao)|CU[RW])(\|[^{}]+|)\}\}/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[AK]|Czechoslovakia)|CS[AK])(\|[^{}]+|)\}\}/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[AN]|Spain)|ESP|SP[AN])(\|[^{}]+|)\}\}/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|M[ée]xico)|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|S[aã]o Tom[eé] (?: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 ?[Nn]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(/(\[\[)Ultratop\|(Ultratop \d+\]\])/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, '[[$1]]$2'); //disabled in favour of case-sensitive simplification of piped links

///links
	regex(/\[\[(Nazi)\]\] \[\[(war crim(?:inal|e)s?)\]\]/gi, '[[$1 $2]]');

	regex(/In \[\[E(lections in the European Union)\|European elections\]\]/g, 'For [[e$1]]');
	regex(/\[\[(European Parliament constituency)\|constituency(?: of the\]\]|\]\] of the) \[\[European Parliament\]\]/gi, '[[$1]]');
	regex(/\[\[Member state of the European Union\|(member states?)(?: of the\]\]|\]\] of the) \[\[(European Union)\]\]/gi, '[[$1 of the $2]]');
	regex(/\[\[Political groups of the European Parliament\|political group(?: in the\]\]|\]\] in the) \[\[European Parliament\]\]/gi, '[[political group of the European Parliament]]');

	regex(/(Nazi) \[\[(war crim(?:inal|e)s?)\]\]/gi, '[[$1 $2]]');
	regex(/(Chinese) \[\[(Public Security Bureau)\]\]/gi, '[[$1 $2]]');
	regex(/(\[\[)(?:March 11,|11 March) (2004 Madrid train bombings)/gi, '$1$2');
	regex(/\[\[([48]0[48][0458])\]\]/g, '[[Intel $1|$1]]');
	regex(/''\[\[Playboy\]\]('' magazine's) \[\[Playboy Playmate\|(Playmate of the Month)\]\]/gi, '\'\'Playboy$1 $2');
    regex(/\[\[(?:International Air Transport Association\||)IATA\]\]\s*(\[\[(?:International Air Transport Association|IATA) airport code\|)(?:airport |)code\]\]/gi, '$1IATA airport code]]');
    regex(/\[\[(?:International Civil Aviation Organization\||)ICAO\]\]\s*(\[\[ICAO airline designator\|)Designator\]\]/gi, '$1ICAO designator]]');
    regex(/\[\[Bollywood\|(Hind[iu]|Urdu)\]\]/gi, '[[$1]]');
    regex(/(\[\[(?:List of |)Bollywood films of \d{4}\|\d{4})(\]\]) (Bollywood(?: film|))/gi, "$1 $3$2");
    regex(/(\[\[(?:List of |)Bollywood films of \d{4}\|\d{4})(\]\]) \[\[(Bollywood)\]\]/gi, "$1 $3$2");
	regex(/(anti-)\[\[(apartheid)\]\]/gi, '[[Internal resistance to apartheid|$1$2]]');
	regex(/\[\[(?:pundit \(expert\))\|([^|\]]+)(?=\])/gi, '[[$1');

//city, state
	regex(/(\[\[(?:Ascot|Bray|Eton|Newbury|Reading|Windsor|Woodley|Sandhurst)), England(\]\]|\|)/gi, '$1, Berkshire$2'); //avoid unlinking
	regex(/(\[\[(?:Winslow|Marlow|Olney)), England(\]\]|\|)/gi, '$1, Buckinghamshire$2'); //avoid unlinking
	regex(/(\[\[(?:March|Ramsey|St Ives)), England(\]\]|\|)/gi, '$1, Cambridgeshire$2'); //avoid unlinking
	regex(/(\[\[(?:Louth|Alford|Boston|Bourne|Crowle|Epworth|Broughton|Bottesford|Horncastle|Long Sutton|Gainsborough)), England(\]\]|\|)/gi, '$1, Lincolnshire$2'); //avoid unlinking
	regex(/(\[\[(?:Cobham|Ashford|Redhill)), England(\]\]|\|)/gi, '$1, Surrey$2'); //avoid unlinking
	regex(/(\[\[(?:Hull)), England(\]\]|\|)/gi, '[[Kingston upon Hull$2'); //avoid unlinking
	regex(/(\[\[(?:Kingston)), England(\]\]|\|)/gi, '$1 upon Thames$2'); //avoid unlinking
	regex(/(\[\[(?:Loftus|Malton|Richmond|Pickering|Grangetown|Scarborough)), England(\]\]|\|)/gi, '$1, North Yorkshire$2'); //avoid unlinking
	regex(/(\[\[(?:Maltby|Thorne|Swinton|Hatfield|Stainforth)), England(\]\]|\|)/gi, '$1, South Yorkshire$2'); //avoid unlinking
	regex(/(\[\[(?:Morley|Yeadon|Halifax|Shipley|Rothwell|Normanton)), England(\]\]|\|)/gi, '$1, West Yorkshire$2'); //avoid unlinking
	regex(/(\[\[(?:Aberdeen))(, Scotland)(\]\]|\|)/gi, '$1$2$3'); 
	regex(/(\[\[(?:Montrose)), Scotland(\]\]|\|)/gi, '$1, Angus$2'); //avoid unlinking
	regex(/(\[\[(?:Rust)), Germany(\]\]|\|)/gi, '$1, Baden-Württemberg$2'); //avoid unlinking
	regex(/(\[\[(?:Alford|Banff|Blackburn|Boddam|Chapelton|Ellon|Kintore|Macduff|Maud|Westhill)), Scotland(\]\]|\|)/gi, '$1, Aberdeenshire$2'); //avoid unlinking
	regex(/(\[\[(?:Annan|Thornhill)), Scotland(\]\]|\|)/gi, '$1, Dumfries and Galloway$2'); //avoid unlinking
	regex(/(\[\[(?:Haddington)), Scotland(\]\]|\|)/gi, '$1, East Lothian$2'); //avoid unlinking
	regex(/(\[\[(?:Dysart|Leven|Letham|Methil|Falkland|Newburgh)), Scotland(\]\]|\|)/gi, '$1, Fife$2'); //avoid unlinking
	regex(/(\[\[(?:Mayfield)), Scotland(\]\]|\|)/gi, '$1, Midlothian$2'); //avoid unlinking
	regex(/(\[\[(?:Elgin|Keith)), Scotland(\]\]|\|)/gi, '$1, Moray$2'); //avoid unlinking
	regex(/(\[\[(?:Linwood|Ralston|Bishopton)), Scotland(\]\]|\|)/gi, '$1, Renfrewshire$2'); //avoid unlinking
 	regex(/(\[\[(?:Kelso|Melrose|Selkirk)), Scotland(\]\]|\|)/gi, '$1, Scottish Borders$2'); //avoid unlinking
	regex(/(\[\[(?:Roberton|Biggar|Blantyre|Cartland|Hamilton|Stonehouse)), Scotland(\]\]|\|)/gi, '$1, South Lanarkshire$2'); //avoid unlinking
	regex(/(\[\[(?:Alexandria)), Scotland(\]\]|\|)/gi, '$1, West Dumbartonshire$2'); //avoid unlinking
	regex(/(\[\[(?:Armadale|Bridgend|Broxburn|Whitburn|Blackburn|Blackridge|Livingston|Ballencrieff)), Scotland(\]\]|\|)/gi, '$1, West Lothian$2'); //avoid unlinking
	regex(/(\[\[(?:Bangor)), Wales(\]\]|\|)/gi, '$1, Gwynedd$2'); //avoid unlinking
	regex(/(\[\[(?:Blackwood)), Wales(\]\]|\|)/gi, '$1, Caerphilly$2'); //avoid unlinking
	regex(/(\[\[(?:Knock)), Ireland(\]\]|\|)/gi, '$1$2, County Mayo|$2$3$4'); //reinstate/retrain ambiguous link
	regex(/(\[\[(?:Kingston)), Canada(\]\]|\|)/gi, '$1, Ontario$2'); //avoid unlinking
	regex(/(\[\[(?:Aberdeen|Edinburgh|Glasgow))(, Scotland)(\]\])/gi, '$1$3$2'); //Sea of blue
	regex(/(\[\[(?:Caerphilly|Camarthen|Cardiff|Port Talbot|Swansea))(, Wales)(\]\])/gi, '$1$3$2'); 
	regex(/(\[\[(?:Bloemfontein|Cape Town|Durban|Johannesburg|Pretoria))(, South Africa)(\]\])/gi, '$1$3$2'); 
	regex(/(\[\[(?:Birmingham|Brighton|Bristol|Liverpool|London|Manchester))(, England|United Kingdom|U\.?K\.?)(\]\])/gi, '$1$3$2'); 
	regex(/(\[\[(Aberdeen|Edinburgh|Glasgow))(?:, Scotland)(?:\|\2)(\]\])/gi, '$1$3'); //useless pipe
	regex(/(\[\[(Caerphilly|Camarthen|Cardiff|Port Talbot|Swansea))(?:, Wales)(?:\|\2)(\]\])/gi, '$1$3'); 
	regex(/(\[\[(Bloemfontein|Cape Town|Durban|Johannesburg|Pretoria))(?:, South Africa)(?:\|\2)(\]\])/gi, '$1$3'); 
	regex(/(\[\[(Birmingham|Brighton|Bristol|Liverpool|London|Manchester))(?:, England|United Kingdom|U\.?K\.?)(?:\|\2)(\]\])/gi, '$1$3'); 

// retraining: Who the hell uses "riding" in Yorkshire subdivisions?
	regex(/(\[\[)(?:(East |West |North |)Riding of Yorkshire)\|\2Riding\]\] of \[\[(Yorkshire\]\])/gi, '$1$2 $3');  
	regex(/\[\[(East |West |North |)Riding\]\] of \[\[(Yorkshire\]\])/gi, '\[\[$1 $2'); 
	regex(/(East|North|West) Riding of( Yorkshire)/gi, '$1$2'); 

	regex(/\[\[(?:Vancouver\||)Vancouver B. C.\]\]/gi, 'Vancouver'); //retraining

	regex(/(\[\[(?:Provinces|Region|States) of ([^|\]]+))\|((?:Province|Region|State)s?)\]\]( of )\[\[\2(\]\])/gi, '$1|$3$4$2$5'); 
	regex(/\[\[(?:Xinjiang\||)Xinjiang.U[^\]]+ Autonomous Region\]\]/gi, 'Xinjiang'); //retraining
	regex(/(\[\[(?:Han|Jin|Liao|Ming|Qing?|Shang|Song|Sui|Tang|Xi[an]|Yuan|Zhou))(?: Dynasty)(?=[\]|])/g, '$1 dynasty');	// China subdivisions
//remove redundant/chained Malay honorifics
	regex(/\[\[(?:Malay (?:styles and |)titles\||)(Tun|Tan Sri|Datuk(?: Seri|)|Dato'(?: Sri|)|Pehin|Dato Paduka)\]\] ?(?=\[\[)/gi, '');
	
     //United Nations
//	regex(/(foo)(bar)/g, '$1 $2');
	regex(/(\[\[UNESCO)\]\] \[\[(World Heritage Site\]\])/gi, '$1 $2');
	regex(/(\[\[World Heritage Site\]\] by) \[\[(UNESCO)\]\]/gi, '$1 $2');
	regex(/(''')(?:\[\[(?:United Nations|UN|U\.N\.|UNO|U\.N\.O\.)\]\]|United Nations) \[\[(United Nations|U.N.) (Security Council [Rr]esolution)\|(?:Security Council [Rr]esolution)\]\]( 1?\d{3}''')/g, '$1$2 $3$4');
	regex(/(''')(?:\[\[)(United Nations|U.N.) (Security Council [Rr]esolution)\]\]( 1?\d{3}''')/g, '$1$2 $3$4');
	regex(/(after re(?:call|affirm)ing (?:all |)(?:previous |))(resolutions)(?= [^\[])/gi, '$1[[United Nations Security Council resolution|$2]]');
	regex(/\[\[(?:United Nations|UN|U\.N\.|UNO|U\.N\.O\.)\]\] \[\[(United Nations|U.N.) (General Assembly|Secretar(?:iat|y[ -]General)|Security Council)\|(?:General Assembly|Secretar(?:iat|y General)|Security Council)\]\]/g, '[[$1 $2]]');

     //post-nominals  
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/(\]\] )\[\[(?:Fellow of the |)Royal (?:Academy|Society)(?: of [\w]+|)\|(F?R\w{1,3})\]\]/gi, '$1$2');

     //professions  
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(United States\|American)\]\](?: politician|\[\[politician\]\])/gi, '[[politics of the $1 politician]]');
	regex(/\[\[(United Kingdom\|British)\]\](?: politician|\[\[politician\]\])/gi, '[[politics of the $1 politician]]');
	regex(/\[\[(British)\]\]( politician)/gi, '[[politics of the United Kingdom|$1$2]]');
	regex(/(British )\[\[(politician)\]\]/gi, '[[politics of the United Kingdom|$1$2]]');
	regex(/\[\[(?:The |)(Netherlands\|Dutch)\]\]( politician)/gi, '[[politics of the $1$2]]');
	regex(/\[\[(?:The |)(Republic of Ireland\|Irish)\]\]( politician)/gi, '[[politics of the $1$2]]');
	regex(/\[\[(?:The |)(Republic of China\|Taiwanese)\]\]( politician)/gi, '[[politics of the $1$2]]');
	regex(/\[\[(?:The |)(People's Republic of China\|Chinese)\]\]( politician)/gi, '[[politics of the $1$2]]');
	regex(/\[\[((?:Argentina|Australia|Brazil|Canada|Chile|Czech Republic|France|Germany|India|Israel|Italy|Japan|Pakistan|Poland|Russia|South Africa|Scotland|Spain|South Korea|Switzerland|Thailand|Wales)\|(?:Argentinian|Australian|Brazilian|Canadian|Chilean|Czech|French|German|Indian|Israeli|Italian|Japanese|Pakistani|Polish|Russian|South African|Scottish|Spanish|South Korean|Swiss|Thai|Welsh))\]\]( politician)([^,])/gi, '[[politics of $1$2]]$3');
	regex(/\[\[(politician)\]\]/gi, '$1');
	
///piped links
	regex(/(\[\[)(?:(?:U.N.|UN|United Nations) (?:General[- ]Secretary|Secretary[- ]General)|(?:General[- ]Secretary|Secretary[- ]General) 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(/(\[\[)(?:(?:U.S.|US|United States|American) Vice[- ]President|Vice[- ]President of the (?:U.S.|US|U.S.A.|USA|United States(?: of America|)))(\|)/gi, '$1Vice President of the United States$2');

	regex(/\[\[(?:(?:United States|U\.S\.|US) (?:Congress(?:man|)|Senate))\|((?:United States |U\.S\. |US |)(?:Congress(?:wo|)man|Senator))\]\](?=,? \[\[)/gi, '$1');
	regex(/\[\[(?:member of parliament(?: \(|#)United Kingdom\)?)\|(MP)\]\](?=,? \[\[)/gi, '$1');

/// glossing fixes: wiktionary
    regex(/\[\[((?:Ep|Mon)onym)\]\]/gi, '[[:wikt:$1|$1]]');
    regex(/\[\[(?:(?:Ep|Mon)onym\||)((Ep|Mon)onymous(?:ly|))\]\]/gi, '[[:wikt:$2onym|$1]]');
    regex(/\[\[(?:Mononymous person\||)(?:mononymously)\]\]( known )/g, 'simply$1');
    regex(/( known )\[\[(?:Mononymous person\||)(?:mononymously)\]\]/g, '$1simply');
    regex(/\[\[(?:Mononymous person\||)(Mononym(?:ous(?:ly|)|))\]\]/gi, '[[:wikt:mononym|$1]]');
    regex(/\[\[(Emeritus)\]\] \[\[Professor\]\]/gi, '[[:wikt:$1|$1]] professor');
    regex(/\[\[Professor\]\] \[\[(Emeritus)\]\]/gi, '[[:wikt:$1|$1]] professor');
    regex(/\[\[(Emeritus)\]\]/gi, '[[:wikt:$1|$1]]');


}

function Ohc_allcountries() {
 var	txt=document.editform.wpTextbox1;

//recognised sovereign states and a few unrecognised ones
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua (?:and|&) Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bosnia (?:and|&) Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of (?:the |)Congo|Costa Rica|Côte d.Ivoire|Ivory Coast|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|England|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia|(?:East |West |)Germany|Ghana|Greece|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|(?:North |South |)Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia(?: FYRO|)|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|M[ée]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[uú]|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(/\[\[(Republic of |)(Abkhazia|Albania|Angola|Argentine Republic|Armenia|Austria|Azerbaijan|Belarus|Botswana|Bulgaria|Burundi|Cameroon|Cape Verde|Chad|Chile|Colombia|Costa Rica|Côte d.Ivoire|Ivory Coast|Croatia|Cuba|Cyprus|Djibouti|Ecuador|El Salvador|Equatorial Guinea|Estonia|the Fiji Islands|Finland|French Republic|Gabonese Republic|Ghana|Hellenic Republic|Guatemala|Guinea|Guinea-Bissau|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iraq|Italian Republic|Kazakhstan|Kenya|Kiribati|Korea|Kosovo|Kyrgyz Republic|Latvia|Lebanese Republic|Liberia|Lithuania|Macedonia|Madagascar|Malawi|Maldives|Mali|Malta|the Marshall Islands|Mauritius|Myanmar|Moldova|Mozambique|Nagorno-Karabakh Republic|Namibia|Nauru|Nicaragua|Niger|Palau|Palestine|Panama|Paraguay|Per[uú]|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(/\[\[(Kingdom of |Principality of |)(Andorra|Liechtenstein|Monaco|Myanmar|Israel|Kuwait|Qatar|Bahrain|Belgium|Bhutan|Brunei|Cambodia|Denmark|Lesotho|Morocco|The Netherlands|Norway|Saudi Arabia|Spain|Swaziland|Sweden|Thailand|Tonga)\]\]/gi, '$1$2');
	regex(/\[\[(Islamic Republic of Afghanistan|People's Democratic Republic of Algeria|Hashemite Kingdom of Jordan|Democratic People's Republic of Korea|Commonwealth of Australia|Commonwealth of The Bahamas|Commonwealth of Dominica|People's Republic of Bangladesh|Plurinational State of Bolivia|Federative Republic of Brazil|State of Brunei, Abode of Peace|Arab Republic of Egypt|Federal Democratic Republic of Ethiopia|Islamic Republic of Iran|Great Socialist People's Libyan Arab Jamahiriya|Federated States of Micronesia|Union of Myanmar|People's Republic of China|Union of the Comoros|Democratic Republic of Timor-Leste|State of Eritrea|Federal Republic of Germany|Co-operative Republic of Guyana|Grand Duchy of Luxembourg|Lao People's Democratic Republic|Islamic Republic of Mauritania|United Mexican States|Transnistrian Moldovan Republic|Federal Democratic Republic of Nepal|Federal Republic of Nigeria|Turkish Republic of Northern Cyprus|Sultanate of Oman|Islamic Republic of Pakistan|Independent State of Papua New Guinea|Independent State of Samoa|Democratic Republic of São Tomé (?:and|&) Príncipe|Democratic Socialist Republic of Sri Lanka|Swiss Confederation|Syrian Arab Republic|United Republic of Tanzania|Eastern Republic of Uruguay|State of the Vatican City|Bolivarian Republic of Venezuela|Socialist Republic of Vietnam|United Kingdom of Great Britain (?:and|&) Northern Ireland|United States of America)\]\]/gi, '$1');
	regex(/\[\[Chinese Taipei\]\]/g, 'Republic of China');

	regex(/\[\[(?:Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua (?:and|&) Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bosnia (?:and|&) Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of (?:the |)Congo|Costa Rica|Côte d.Ivoire|Ivory Coast|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia \(country\)|Germany|Ghana|Greece|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |Northern |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|Myanmar|North Korea|South Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia(?: FYRO|)|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|Myanmar|M[ée]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[uú]|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(/\[\[(?:Chinese|Korean|Philippine|Filipino|Czech|Danish|English|French|Finnish|German|Greek|Italian|Japanese|Portuguese|Russian|Scandinavian|Spanish)\s\(?language\)?\|(Chinese|Korean|Philippine|Filipino|Czech|Danish|English|French|Finnish|German|Greek|Italian|Japanese|Portuguese|Russian|Scandinavian|Spanish)\]\]/gi, '$1'); //piped to "language"
	regex(/\[\[(US|U\.S\.(A\.|)|USA)\]\]/g, 'US');
	regex(/\[\[(U\.K\.|UK)\]\]/g, 'UK');
	regex(/\[\[(U\.N\.|UN)\]\]/g, 'UN');
	regex(/\[\[((?:Asia|Africa|Americas?|Antartica|Europe|Australia|Oceania|Asia-Pacific|(?:Middle|Far) East))\]\]/gi, '$1');

//rem linking templates

//	regex(/\[\[(foobar)\]\]/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(/\[\[(foobar)\]\]/gi, '$1');
	regex(/(\[\[Washington )\(U.?S.? state\)\|/gi, '$1(state)|');
	regex(/\[\[(Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|District of Columbia|Florida||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|West Virginia|Washington|Wisconsin|Wyoming)(?: state|)\]\]/gi, '$1');

	regex(/\[\[Georgia \(U.?S.? state\)\|(Georgia)(?: state|)\]\]/gi, '$1');
	regex(/\[\[New York \(state\)\|(New York)(?: state|)\]\]/gi, '$1');
	regex(/\[\[(Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|District of Columbia|Florida||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|West Virginia|Washington|Wisconsin|Wyoming)(?: state|)(?:\|\w\w)\]\]/gi, '$1');
	regex(/\[\[(Georgia|New York|Washington) \(state\)\|(?:GA|NY|WA|Georgia|New York|Washington)\]\]/gi, '$1');

	regex(/\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)(?:\|(?:AB|Alta\.?|B\.?C\.?|Man\.?|MB|N\.?B\.?|N\.?S\.?|Nfld\.?, Lab\.?|NL|ON|Ont\.?|P\.E\.I\.|PE|PEI|QC|Que\.?, P\.?Q\.?|Sask\.?|SK)|)\]\]/gi, '$1');

}
function Ohc_CommonTerms(){
 var txt=document.editform.wpTextbox1;

//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(United States(?: of America|)\||)(US|U\.S\.(A\.|)|USA)\]\]/g, 'US');
	regex(/\[\[((?:UK of GB (?:&|and) N?I|United Kingdom(?: of Great Britain and (?:Northern |)Ireland))\||)(U\.K\.|UK)\]\]/g, 'UK');
	regex(/\[\[(U\.N\.|UN)\]\]/g, 'UN');

// Chained country links
//    regex(/\{\{\s?flag\s?\|/gi, '{{flagu|'); //disabled 4 Aug 2014
//	regex(/\{\{UK\}\}/g, 'United Kingdom');
	regex(/(\]\] in )\[\[(Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Argentina|Armenia|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of (?:the |)Congo|Costa Rica|Côte d.Ivoire|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia \(country\)|Germany|Ghana|Greece|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|North Korea|South Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia(?: FYRO|)|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|M[ée]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[uú]|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 ))\[\[(?:(?:People's |)Republic of China|Georgia \(Country\))\|(China|Georgia|Taiwan)\]\](?=,?[ ]*[^\[]| and [^\[]|\))/gi, '$1$2');
	regex(/(\]\], )\[\[(Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Argentina|Armenia|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of (?:the |)Congo|Costa Rica|Côte d.Ivoire|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia \(country\)|Germany|Ghana|Greece|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|North Korea|South Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia(?: FYRO|)|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|M[ée]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[uú]|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)\]\](?=\.|[ ]*[\n\r])/gi, '$1$2');
	regex(/(\]\], )\[\[(British (?:India|Raj))\]\](?=\.|[ ]*[\n\r])/gi, '$1$2');

// Chained country links with typo
	regex(/(\]\], )\[\[Phillipp?ine(s|)\]\](?=\.|[ ]*[\n\r])/gi, '$1Philippine$2');

// Country/nationality 
//Link rationalisation
        regex(/(\]\], )\[\[(England|Wales|Scotland|Northern Ireland)\]\](?:,? \[\[United Kingdom(?:\|UK|)\]\]|United Kingdom|UK)(?=\.|[ ]*[\n\r])/gi, '$1$2');

//Nationalities egged to country
        regex(/\[\[(Abkhazia|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Armenia|Australia|Austria|Azerbaijan|Bahrain|Bangladesh|Belarus|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Chad|Chile|Colombia|Comoros|Congo|Costa Rica|Côte d.Ivoire|Croatia|Cuba|Cyprus|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Gabon|Ghana|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Iceland|India|Indonesia|Iran|Iraq|Israel|Jamaica|Japan|Jordan|Kenya|Kiribati|North Korea|South Korea|Kosovo|Kuwait|Latvia|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia(?: FYRO|)|Malawi|Malaysia|Maldives|Mali|Marshall Islands|Mauritania|(?:Federated States of |)Micronesia|Moldova|Mongolia|Nagorno-Karabakh|Namibia|Nauru|Nepal|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Oman|Pakistan|Palau|Palestine?|Panama|Papua New Guinea|Paraguay|Per[uú]|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(/\[\[Belgium\|(Belgian)\]\]/gi, '$1');
        regex(/\[\[(?:Burma|Myamnar)\|(Burmese)\]\]/gi, '$1');
        regex(/\[\[Canada\|(Canadian)\]\]/gi, '$1');
        regex(/\[\[(?:(?:People's |)Republic of |)China\|(Chinese)\]\]/gi, '$1');
        regex(/\[\[(?:Czech|Slovak) Republic\|(Czech|Slovak(?:ian|))\]\]/gi, '$1');
        regex(/\[\[Cyprus\|(Cypriot)\]\]/gi, '$1');
        regex(/\[\[(?:Kingdom of |)Denmark\|(Danish)\]\]/gi, '$1');
        regex(/\[\[France\|(French)\]\]/gi, '$1');
        regex(/\[\[Finland\|(Finnish)\]\]/gi, '$1');
        regex(/\[\[Greece\|(Greek)\]\]/gi, '$1');
        regex(/\[\[(?:East |West  |)Germany\|((?:East |West  |)German)\]\]/gi, '$1');
        regex(/\[\[(?:(?:(?:Kingdom of |)the |)Netherlands|Holland)\|(Dutch)\]\]/gi, '$1');
        regex(/\[\[Honduras\|(Honduran)\]\]/gi, '$1');
        regex(/\[\[Hungary\|(Hungarian)\]\]/gi, '$1');
        regex(/\[\[(?:Republic of |)Ireland\|(Irish)\]\]/gi, '$1');
        regex(/\[\[Italy\|(Italian)\]\]/gi, '$1');
        regex(/\[\[Laos\|(Laotian)\]\]/gi, '$1');
        regex(/\[\[Lebanon\|(Lebanese)\]\]/gi, '$1');
        regex(/\[\[Republic of Macedonia\|(Macedonian)\]\]/gi, '$1');
        regex(/\[\[Madagascar\|(Madagascan)\]\]/gi, '$1');
        regex(/\[\[Malta\|(Maltese)\]\]/gi, '$1');
        regex(/\[\[Monaco\|(Mon[eé]gasque)\]\]/gi, '$1');
        regex(/\[\[Mozambique\|(Mozambican)\]\]/gi, '$1');
        regex(/\[\[(M[ée]xic|Montenegr|Morocc)o\|\1(an)\]\]/gi, '$1$2');
        regex(/\[\[Mauritius\|(Mauritian)\]\]/gi, '$1');
        regex(/\[\[Norway\|(Norwegian)\]\]/gi, '$1');
        regex(/\[\[Poland\|(Polish)\]\]/gi, '$1');
        regex(/\[\[Portugal\|(Portuguese)\]\]/gi, '$1');
        regex(/\[\[(?:Spain|Spaniards?)\|(Spanish)\]\]/gi, '$1');
        regex(/\[\[Swede[ns]?\|(Swed(?:ish|es?))\]\]/gi, '$1');
        regex(/\[\[Switzerland\|(Swiss)\]\]/gi, '$1');
        regex(/\[\[Thailand\|(Thai)\]\]/gi, '$1');
        regex(/\[\[Turkey\|(Turk(?:ish|))\]\]/gi, '$1');
        regex(/\[\[(Afghan|Kazakh|Kyrgyz|Tajik|Turkmeni?|Uzbek)i?stan\|\1\]\]/gi, '$1');

        regex(/\[\[(?:Great Britain|United Kingdom)\|(British|English|Scottish|Welsh)\]\]/gi, '$1'); //[[WP:EGG]]
        regex(/\[\[England\|(English)\]\]/gi, '$1');
        regex(/\[\[(?:Scotland|Scottish people)\|(Scot(?:tish|s?))\]\]/gi, '$1');
        regex(/\[\[Wales\|(Welsh)\]\]/gi, '$1');
        regex(/\[\[Northern Ireland\|(Northern Irish)\]\]/gi, '$1');
        regex(/\[\[(?:USSR|Soviet Union|Union of Soviet Socialist Republics)\|(Soviet)\]\]/gi, '$1');

        regex(/\[\[(?:United Kingdom of Great Britain and Northern Ireland|United Kingdom|Great Britain)\|(UK|United Kingdom|Great Britain)\]\]/gi, '$1');
        regex(/(]\], )\[\[Republic of Ireland\|(Ireland)\]\](?=[\.\)]|[ ]*[\n\r])/gi, '$1$2');
        regex(/\[\[(?:(?:Republic of |)Ireland\|)(Republic of Ireland|Ireland|Irish)\]\]/gi, '$1');

		regex(/\[\[(Arabian?|Argentinian?|Australian?|Austrian?|Belgian|Bolivian?|Bosnian?|Brazilian|British|Canadian|Dutch|(?:North |South |)Korean?|Chinese|(?:Ph|F)ilippino|Chile(?:an|)|Colombian?|Czech|Danish|English|Egypt(?:ian|)|Estonian?|Finnish|French|Greek|Hungarian|Indian?|Indonesian?|Irish|Italian|Japan(?:ese|)|Jewish|Latvian?|Lithuanian?|Malay(?:sian|)|Mexican|Middle\sEastern|New\sZealand(er|)|Norwegian|Pakistani?|Palestinian|Peru(?:vian|)|Polish|Portuguese|Romanian?|Russian?|Scandinavian?|Scottish|Slovakian?|South\sAfrican?|Spanish|Swedish|Swiss|Taiwan(?:ese|)|Welsh|(?:East |West |)German)( people|s?)\]\](?= \[\[|\w)/gi, '$1$2');
		regex(/\[\[(?:Arabian|Argentinian|Australian|Austrian|Bolivian|Bosnian|Brazilian|(?:North |South |)Korean|Colombian|Estonian|Indian|Indonesian|Italian|Latvian|Lithuanian|Pakistani|Romanian|Russian|Scandinavian|Slovakian|South\sAfrican)(?:s| people)\|([^\]]+)\]\]/gi, '$1');

// Country subdivisions
//	regex(/(\]\](?:, | in ))\[\[(Australian Capital Territory|Jervis Bay Territory|New South Wales|Northern Territory|Queensland|South Australia|Tasmania|Victoria|Western Australia)\]\]/gi, '$1$2'); // Australian subdivisions
	regex(/(\]\](?:, | in ))\[\[Victoria \(Australia\)\|(Victoria)\]\]/gi, '$1$2');
	regex(/(\[\[(?:Anhui|Fujian|Gansu|Guangdong|Guizhou|Hainan|Hebei|Heilongjiang|Henan|Hubei|Hunan|Jiangsu|Jiangxi|Jilin|Liaoning|Qinghai|Shaanxi|Shandong|Shanxi|Sichuan|Yunnan|Zhejiang|Guangxi|Ningxia))(?: Province)(?=[\]|])/gi, '$1');	// China subdivisions
	regex(/(\[\[(?:Anhui|Fujian|Gansu|Guangdong|Guizhou|Hainan|Hebei|Heilongjiang|Henan|Hubei|Hunan|Jiangsu|Jiangxi|Jilin|Liaoning|Qinghai|Shaanxi|Shandong|Shanxi|Sichuan|Yunnan|Zhejiang|Guangxi|Ningxia)(?:\]\]))(?: Provinces?)/gi, '$1');	// China subdivisions
	regex(/(\]\](?:, | in ))\[\[(Anhui|Fujian|Gansu|Guangdong|Guizhou|Hainan|Hebei|Heilongjiang|Henan|Hubei|Hunan|Jiangsu|Jiangxi|Jilin|Liaoning|Qinghai|Shaanxi|Shandong|Shanxi|Sichuan|Yunnan|Zhejiang|Guangxi|Inner Mongolia|Ningxia|Tibet(?: Autonomous Region|)|Xinjiang(?: Autonomous Region|)|Beijing|Chongqing|Shanghai|Tianjin|Hong Kong|Maca[ou])\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');	// China subdivisions
	regex(/(\]\](?:, | in ))\[\[(?:Tibet|Xinjiang) Autonomous Region\|(Tibet|Xinjiang)\]\]/gi, '$1$2');
	regex(/\[\[((?:\w+-|)\w+ Region, Singapore\|(?:\w+-|)\w+ Region)\]\] (in|of) \[\[Singapore\]\]/gi, '[[$1 $2 Singapore]]');
	regex(/(\]\](?:, | in ))\[\[([\w ]+province)\]\]/gi, '$1$2');

//	regex(/\[\[(foobar)\]\]/gi, '$1');
//	regex(/\[\[(d[eé]parte?ments? (?:in|of) France)\|d[eé]parte?ment\]\]/gi, 'département');
	regex(/(\]\](?:, | in ))\[\[(Alsace|Angoumois|Anjou|Artois|Aunis|Béarn|Bourbonnais|Brittany|Corsica|Dauphiné|Flanders|Forez|Franche-Comté|Gascony|Guyenne|Languedoc|Lyonnais|Montbéliard|Mulhouse|Nivernais|Normand(?:ie|y)|Orléanais|Perche|Picardy|Poitou|Provence|Roussillon|Saintonge|Savoy|Touraine)\]\]/gi, '$1$2'); //historical French provinces
	regex(/(\]\](?:, | in ))\[\[(Ain|Aisne|Allier|Alpes-de-Haute-Provence|Hautes-Alpes|Alpes-Maritimes|Ardèche|Ariège|Aube|Aude|Aveyron|Bouches-du-Rhône|Calvados|Cantal|Charente|Charente-Maritime|Corrèze|Corse-du-Sud|Haute-Corse|Côte-d'Or|Côtes-d'Armor|Creuse|Dordogne|Doubs|Drôme|Eure|Eure-et-Loir|Finistère|Gard|Haute-Garonne|Gers|Gironde|Hérault|Ille-et-Vilaine|Indre|Indre-et-Loire|Isère|Loir-et-Cher|Loire|Haute-Loire|Loire-Atlantique|Loiret|Lot-et-Garonne|Lozère|Maine-et-Loire|Manche|Marne|Haute-Marne|Mayenne|Meurthe-et-Moselle|Meuse|Morbihan|Moselle|Nièvre|Oise|Orne|Pas-de-Calais|Puy-de-Dôme|Pyrénées-Atlantiques|Hautes-Pyrénées|Pyrénées-Orientales|Bas-Rhin|Haut-Rhin|Haute-Saône|Saône-et-Loire|Sarthe|Savoie|Haute-Savoie|Paris|Seine-Maritime|Seine-et-Marne|Yvelines|Deux-Sèvres|Somme|Tarn-et-Garonne|Vaucluse|Vendée|Vienne|Haute-Vienne|Vosges|Yonne|Territoire de Belfort|Essonne|Hauts-de-Seine|Seine-Saint-Denis|Val-de-Marne|Val-d'Oise|Guadeloupe|Martinique|French Guiana|Réunion)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // French subdivisions

	regex(/(\]\](?:, | in ))\[\[(?:Ardennes|Cher|Jura|Landes|Lot|Nord|Rhône|Tarn|Var) \((?:French |)department\)\|(Ardennes|Cher|Jura|Landes|Lot|Nord|Rhône|Tarn|Var)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); 
	regex(/(\]\](?:, | in ))\[\[(?:Auvergne|Beaujolais|Berry|Burgundy|Hainaut|Île-de-France|Limousin|Maine) \((?:province|france|region)\)\|(Auvergne|Beaujolais|Berry|Burgundy|Hainaut|Île-de-France|Limousin|Maine)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); 

	regex(/(\]\](?:, | in ))\[\[(Andalusia|Aragon|Asturias|Balearic Islands|Canary Islands|Cantabria|Castile and León|Castile-La Mancha|Catalonia|Extremadura|Navarre|Valencian Community|Islas Chafarinas|Peñón de Alhucemas|Peñón de Vélez de la Gomera)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // Spanish
	regex(/(\]\](?:, | in ))\[\[(?:Basque Country \(autonomous community\)|Community of Madrid|Region of Murcia)\|(Basque Country|Madrid|Murcia)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');
	regex(/(\]\](?:, | in ))\[\[(?:Galicia|La Rioja) \(Spain\)\|(Galicia|La Rioja)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');
	regex(/(\]\](?:, | in ))\[\[(Baden-Württemberg|Bavaria|Berlin|Brandenburg|Hamburg|Hesse|Ländereinführungsgesetz|Lower Saxony|Mecklenburg-Vorpommern|North Rhine-Westphalia|Rhineland-Palatinate|Saarland|Saxony|Saxony-Anhalt|Schleswig-Holstein|South Baden|Thuringia|Württemberg-Baden|Württemberg-Hohenzollern)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');	// German subdivisions
	regex(/(\]\](?:, | in ))\[\[(Andhra Pradesh|Arunachal Pradesh|Assam|Bihar|Chhattisgarh|Goa|Gujarat|Haryana|Himachal Pradesh|Jammu and Kashmir|Jharkhand|Karnataka|Kerala|Madhya Pradesh|Maharashtra|Manipur|Meghalaya|Mizoram|Nagaland|Orissa|Punjab|Rajasthan|Sikkim|Tamil Nadu|Tripura|Uttar Pradesh|Uttarakhand|West Bengal|Andaman and Nicobar Islands|Chandigarh|Dadra and Nagar Haveli|Daman and Diu|Lakshadweep|Puducherry)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');	// Indian subdivisions
	regex(/(\]\](?:, | in ))\[\[(Lombardy|Campania|Lazio|Sicily|Veneto|Piedmont|Emilia[-–]Romagna|Apulia|Tuscany|Calabria|Sardinia|Liguria|Marche|Abruzzo|Friuli[-–]Venezia Giulia|Trentino[-–]Alto Adige\/Südtirol|Umbria|Basilicata|Molise|Aosta Valley)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // Italian subdivisions

	regex(/(\]\](?:, | in ))\[\[((?:Eastern|Western|Northern|Southern) Cape|Gauteng|KwaZulu-Natal)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); //South African provinces
	regex(/(\]\](?:, | in ))\[\[Free State \((?:South African |)province\)\|(Free State)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); 

	regex(/(\]\](?:, | in (?:the county of |)))\[\[(Bedfordshire|Berkshire|Bristol|Buckinghamshire|Cambridgeshire|Cheshire|Cornwall|Cumbria|Derbyshire|Devon|Dorset|County Durham|(?:East|North|West) Riding of Yorkshire|(?:East |West |)Sussex|Essex|Gloucestershire|Greater London|Greater Manchester|Hampshire|Herefordshire|Hertfordshire|Isle of Wight|Kent|Lancashire|Leicestershire|Lincolnshire|City of London|Merseyside|Norfolk|Northamptonshire|Northumberland|Nottinghamshire|Oxfordshire|Shropshire|Somerset|Staffordshire|Suffolk|Surrey|Tyne and Wear|Warwickshire|West Midlands|Wiltshire|Worcestershire|(?:East |West |North |South |)Yorkshire)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in (?:the county of |)))\[\[West Midlands \((?:county|region)\)\|(West Midlands)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); 
	regex(/(\]\](?:, | in (?:the county of |)))\[\[(Glasgow|Lanarkshire|Edinburgh|Ayrshire|Fife|Dunbartonshire|Stirlingshire|Dundee|Aberdeen|Midlothian|Perthshire|West Lothian|Angus|Inverness-shire|Dumfriesshire|Argyllshire|Ross and Cromarty|East Lothian|Morayshire|Clackmannanshire|Banffshire|Roxburghshire|Caithness|Kirkcudbrightshire|Wigtownshire|Kincardineshire|Selkirkshire|Berwickshire|Shetland|Orkney|Peeblesshire|Buteshire|Sutherland|Nairnshire|Kinross-shire)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in (?:the county of |)))\[\[(\w+shire)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2'); // English subdivisions
	regex(/(\]\](?:, | in ))\[\[(?:County \w+\||)((?:County|Co\.?) \w+)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2');  // Irish subdivisions
	regex(/(\[\[)(\w+)(\]\]), \2shire/gi, '$1$2$3'); // rem shire for county capitals in English subdivisions

// Malaysian states
	regex(/(\]\](?:, | in ))\[\[(?:(Johor|Kedah|Kelantan|Malacca|Negeri Sembilan|Pahang|Perak|Perlis|Penang|Sabah|Sarawak|Selangor|Terengganu|Kuala Lumpur|Labuan|Putrajaya)\||)(Johor|Kedah|Kelantan|Malacca|Negeri Sembilan|Pahang|Perak|Perlis|Penang|Sabah|Sarawak|Selangor|Terengganu|Kuala Lumpur|Labuan|Putrajaya)( State|)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2$3'); 	

// Brazilian states
	regex(/(\]\](?:, | in ))\[\[(?:(?:Amapá|Brazilian Federal District|Pará|Rondônia|Roraima|Tocantins|Alagoas|Bahia|Ceará|Maranhão|Paraíba|Pernambuco|Piauí|Sergipe|Goiás|Mato Grosso(?: do Sul|)|Espírito Santo|Minas Gerais|Rio Grande (?:do Norte|do Sul))\||)(Amapá|Brazilian Federal District|Pará|Rondônia|Roraima|Tocantins|Alagoas|Bahia|Ceará|Maranhão|Paraíba|Pernambuco|Piauí|Sergipe|Goiás|Mato Grosso(?: do Sul|)|Espírito Santo|Minas Gerais|Rio Grande (?:do Norte|do Sul))( State|)\]\](?=,?[ ]*[^\[]| and [^\[])/gi, '$1$2$3'); 	
	regex(/(\]\](?:, | in ))\[\[(?:(?:Acre|Amazonas|Paraná|Rio de Janeiro|Santa Catarina|São Paulo) \((?:Brazilian |)state\)\||)(Acre|Amazonas|Paraná|Rio de Janeiro|Santa Catarina|São Paulo)( [Ss]tate|)\]\](?=,?[ ]*[^\[]| and [^\[])/g, '$1$2$3'); 

// US States piped
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(New York( City|)(?:\]\], \[\[|, )(?:New York|NY))\]\]/gi, 'New York City');
	regex(/\[\[New York \(state\)\|(New York)(?: state|)\]\]/gi, '$1');
	regex(/\[\[(New York( City|)(?:, (?:New York|NY)|))\|New York\]\](?:, New York|, \[\[New York \(state\)\|(?:New York|NY)\]\]|)/gi, 'New York City');
//	regex(/New York(?: City), (?:New York|U\.S\.|USA?)/gi, 'New York City');
	regex(/\[\[(?:(Hollywood|Los Angeles|San\sDiego|San\sFrancisco)(?:\]\], \[\[|, )(?:California|CA))\]\]/gi, '$1, California');
	regex(/\[\[(?:(?:Hollywood|Los Angeles|San\sDiego|San\sFrancisco)(?:,\sCalifornia|,\sCA|))\|([^\]]{1,30})\]\]/gi, '$1');

//	[[Salt Lake City, Utah|Salt Lake City]], [[Utah]] -> [[Salt Lake City, Utah]]
//	regex(/\[\[([^|\[\]]*), ([^|\]]*)\|\1\]\],[ ](?:\2|\[\[\2\]\])/gi, '[[$1, $2]]'); //disabled, changing over to piped city only
	regex(/(\[\[([^|\[\]]*), ([^|\]]*)\|\2\]\],[ ])\[\[\3\]\]/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\[\[(?:Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|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|West Virginia|Wisconsin|Wyoming)(?:\|(?: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)|)\]\]/gi, '$1]]');
//	[[Tacoma, Washington|Tacoma]], [[Washington (U.S. state)|Washington]] -> [[Tacoma, Washington]]
	regex(/(\[\[(?:[^\]]{1,20})\,\s(?:Georgia|Washington)\|(?:[^\]]{1,20})\]\]\,?\s)\[\[(?:Georgia|Washington) \(U. ?S.? state\)\|(Georgia|Washington)\]\]/gi, '$1$2');  //piped city only (no state)
	regex(/(\[\[(?:Brooklyn|Queens|Manhattan|The Bronx))\,\s(New York)\]\]/gi, '$1]], $2');

//regex that turns city links into piped city links
	regex(/(\[\[(?:Queenstown))\,\s(Ireland)\]\]/gi, 'Cobh]], $1');
//disabling 19 June 2011
	regex(/\[\[Auckland,\s(?:New Zealand|NZ)\|(Auckland)\]\]/gi, '[[$1]]');
	regex(/\[\[London,\s(?:England|UK|U\.K\.)\|(London)\]\]/gi, '$1');
	regex(/(\[\[Lyons?|Paris)(, France)(\]\])/gi, '$1$3$2'); //Lyon spelt without 's'
	regex(/\[\[(Paris)\|Paris,\s(?:[IÎ]le[ -]de[ -]|)France\]\]/gi, '$1');
	regex(/(Paris|\[\[Paris\]\]),\s(?:[IÎ]le[ -]de[ -]France|\[\[[IÎ]le[ -]de[ -]France\]\])/gi, '$1');
	regex(/(\[\[Punjab) \((Pakistan|India)\)([\|\]])/gi, '$1, $2$3'); //direct link is not parenthetical
	regex(/(\[\[Lisbon)(, Portugal)(\]\])/gi, '$1$3$2'); 
	regex(/(\[\[Mexico City)(, Mexico)(\]\])/gi, '$1$3$2'); 
	regex(/(\[\[Rio de Janeiro)(, Brazil)(\]\])/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(/(\[\[(?:Brest|Nancy|Sedan))(\]\])(, France)/gi, '$1$3$2'); //reinstate ambiguous link
//	regex(/(\[\[(?:Ardeer|Aberfeldy|Gretna|Papa|Perth|Strathspey))(\]\])(, Scotland)/gi, '$1$3$2'); //reinstate ambiguous link
//	regex(/(\[\[Lincoln)(\]\])(, England)/gi, '$1$3$2'); //reinstate ambiguous link
	regex(/(\[\[(?:Biere|Soest))(\]\])(, Germany)/gi, '$1$3$2'); //reinstate ambiguous link

//	[[Boston]], [[Massachusetts]] -> [[Boston]], Massachusetts
	regex(/(\[\[(?:Atlanta|Baltimore|Boston|Chicago|Cincinnati|Cleveland|Dallas|Denver|Detroit|Honolulu|Houston|Indianapolis|Pittsburgh|Philadelphia|Miami|Minneapolis|New Orleans|Oklahoma City|San Antonio|San Diego|Salt Lake City|San Francisco|Seattle)\]\]),?\s\[\[(California|Colorado|Florida|Hawaii|Illinois|Indiana|Louisiana|Maryland|Massachusetts|Michigan|Minnesota|Ohio|Oklahoma|Pennsylvania|Texas|Utah)\]\]/gi, '$1, $2');
	regex(/(\[\[(?:Atlanta|Seattle)\]\]),?\s\[\[(Georgia|Washington) \((?:US |U.S. |)state\)\|\2\]\]/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(/\[\[(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)\]\]/gi, '[[$1]], $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\[\[\2(?:\|(?:AB|Alta\.?|B\.?C\.?|Man\.?|MB|N\.?B\.?|N\.?S\.?|Nfld\.?, Lab\.?|NL|ON|Ont\.?|P\.E\.I\.|PE|PEI|QC|Que\.?, P\.?Q\.?|Sask\.?|SK)|)\]\]/gi, '[[$1, $2]]');
	regex(/(\]\](?:, | in ))\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan|Toronto|Montreal|Vancouver|Ottawa|Calgary|Edmonton|Quebec City|Quebec|Winnipeg)\]\]/gi, '$1$2');	// Canadian subdivisions
	regex(/(\]\](?:, | in ))\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\|(?:AB|Alta\.?|B\.?C\.?|Man\.?|MB|N\.?B\.?|N\.?S\.?|Nfld\.?, Lab\.?|NL|ON|Ont\.?|P\.E\.I\.|PE|PEI|QC|Que\.?, P\.?Q\.?|Sask\.?|SK)\]\]/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(/\[\[(Canada)\|CAN\]\]/gi, '$1');

	regex(/(\[\[(?:Down|Mid)town )([A-Z]\w*)(?:\|(?:Down|Mid)town)\]\] (?:\[\[\2\]\]|\2)/gi, '$1$2]]');
	regex(/\[\[Sydney(?:,\sNew South Wales|,\sAustralia)\]\]/gi, 'Sydney');
	regex(/\[\[Sydney\]\], (?:\[\[(?:Australia|New South Wales|NSW)\]\]|(?:Australia|New South Wales|NSW))/gi, 'Sydney');
	regex(/\[\[Sydney(?:,\sNew South Wales|,\sAustralia)\|([^\]]{1,30})\]\]/gi, '$1');
	regex(/(\[\[Melbourne)\]\], (?:\[\[(?:Victoria \(Australia\)\|Victoria|Australia)\]\]|Victoria)/gi, '$1]]');
	regex(/\[\[Melbourne(?:,\sVictoria|,\sAustralia)\]\]/gi, '[[Melbourne]]');
    regex(/(\[\[Liverpool)\]\], (?:\[\[(?:Merseyside)\]\]|Merseyside)/gi, '$1]]');
	regex(/\[\[(London)(?:\]\], \[\[|, )(England|United Kingdom|U\.?K\.?)(?:\]\]|)/gi, '$1, England');
	regex(/(London, England), (?:UK|United Kingdom)/gi, '$1');
	regex(/\[\[(Chicago|Detroit|Los Angeles|San\sFrancisco|Miami|New York City)\]\]/gi, '$1');
	regex(/\[\[(Beijing|Paris|Hong\sKong|Moscow|(?:New\s|)Delhi|Shanghai|Singapore|Tokyo)(, [\w\s]+|)\]\]/gi, '$1$2');
	regex(/\[\[(Barcelona|Bogat[aá]|Bombay|Brisbane|Canberra|Frankf[uü]rt|Kyoto|Mexico City|Madrid|Munich|New\sDelhi|Osaka|Ottawa|Florence|Stuttgart|Vienna)(, [\w\s]+|)\]\]/gi, '[[$1]]$2');
	regex(/\[\[(Milan|Venice)(?:\]\], \[\[|, )(Italy)(?:\]\]|)/gi, '[[$1]], Italy');
//	regex(/\[\[(New Orleans(?:, Louisiana|))\]\]/gi, '$1');
	regex(/\[\[(Washington,? (?:DC|D\.C\.))\]\]/gi, '$1');
	regex(/\[\[(California|Florida|Hawai.?i|New\sYork)\]\]/gi, '$1');
	regex(/(\[\[Toronto), Ontario\]\]/gi, '$1]]');
	regex(/(\[\[Toronto), Ontario\|Toronto\]\]/gi, '$1]]');
	regex(/(Toronto|\[\[Toronto\]\]), \[\[Ontario(?:\|ON)?\]\]/gi, '$1');
	regex(/\[\[(Paris, France)\]\]/gi, '$1');
	regex(/\[\[(London)\]\]/gi, '$1'); 
//	regex(/\[\[(?:New York City)\|([^\]]{3,30})\]\]/gi, '$1');
//	regex(/([\w\]], (?:UK|United Kingdom)), (?:UK|United Kingdom)/gi, '$1'); 

	regex(/(\[\[([-\w ]+)(, (?:Birmingham|Bristol|Derry|Edinburgh|London|Liverpool|Manchester)))\]\]/gi, '$1|$2]]$3'); // pipe trick disabled

//chained cities Europe
	regex(/(\]\](?:, | in ))\[\[(Greater |Metropolitan |)(Birmingham|Bristol|Derry|Edinburgh|London|Liverpool|Manchester)\]\]/gi, '$1$2$3'); 
//chained cities -Europe
	regex(/(\]\](?:, | in ))\[\[(Amsterdam|Antwerp|Athens|Barcelona|(?:West |East |)Berlin|Belgrade|Bonn|Brussels|Copenhagen|Dublin|D[uü]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 ))\[\[(Asunción|Bogatá|Buenos Aires|Caracas|La Paz|Lima|Montevideo|(?:Panama|M[ée]xico) City|Quito|S[aã]o Paolo|Santiago|Sucre)\]\]/gi, '$1$2'); 

//ambiguous
	regex(/\[\[(Bogata|Georgetown)\]\]/gi, '$1');

//continents and regions
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(Arctic\sOcean|Atlantic\sOcean|Indian\sOcean|Pacific|Pacific\sOcean)\]\]/gi, '$1');
	regex(/\[\[((?:Asia|Africa|Americas?|Antartica|Europe|Australia|Oceania|Asia-Pacific|(?:Middle|Far) East)(?:a?n|ern|))\]\]/gi, '$1');
	regex(/\[\[((?:north-?(?:west|east|)|south-?(?:west|east|)|east|west|central)(?:ern | )(?:Asia|Africa|America|Atlantic|Europe|Oceania|Pacific|United States|Canada|China|Russia))\]\]/gi, '$1');
	regex(/\[\[((?:north-?(?:west|east|)|south-(?:west|east)|east|central)(?:ern | )Australia)\]\]/gi, '$1');
	regex(/\[\[((?:North|South) Pole)\]\]/gi, '$1'); 
	regex(/\[\[(Latin America)\]\]/gi, '$1');

	regex(/\[\[(?:Asia|Africa|America|Arabia|Europe|Australia|Oceania|Asia-Pacific|(?:Middle|Far) East)\|([^\]]*)\]\]/gi, '$1');

// Country and language; city
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(area|border|cit(?:y center|y centre|ies|y)|countr(?:y|ies)|count(?:y|ies)|district|parish|province|region|rural|suburb|town(?:ship|)|(?:sub|)urban(?: area|)|village|world)\]\]/gi, '$1');
	regex(/\[\[(?:(?:rural|(?:sub)?urban)(?: area|i[sz]ation|)\||)((?:rural|(?:sub|)urban)(i[sz]ed?|i[sz]ation| area|))\]\]/gi, '$1');
	regex(/\[\[(?:urban agglomeration\||)(agglomeration)\]\]/gi, '$1'); 
	regex(/\[\[(?:List of (?:countries|U.S. states|sovereign states)|Countries of the world)\|(country|countries|states?)\]\]/gi, '$1');
	regex(/\[\[((?:US|U\.S\.) state(?:s|))\]\]/gi, '$1');
	regex(/\[\[(?:US|U\.S\.) states?\|(states?)\]\]/gi, '$1');
	regex(/\[\[States and territories of \w*\|(states?)\]\]/gi, '$1');
	regex(/\[\[city\|(cities)\]\]/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(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(?:American|Arabic|Australian|British|Canadian|Chinese|Japanese|English|French|Irish|Italian|Spanish|Russian|German)\s\(?(?:language|literature|people)\)?\|(American|Arabic|Australian|British|Canadian|Chinese|Japanese|English|French|Irish|Italian|Spanish|Russian|German)\]\]/gi, '$1');
	regex(/\[\[(?:Americans\||)(American)\]\]/gi, '$1'); 
	regex(/\[\[(?:Australians\||)(Australian)\]\]/gi, '$1'); 
	regex(/\[\[(?:Canadians\||)(Canadian)\]\]/gi, '$1'); 
	regex(/\[\[(?:Germans\||)(German)\]\]/gi, '$1'); 
	regex(/\[\[(Holy Roman Empire)\|(Germany)\]\]/gi, '[[$1]] ($2)');  //rem per [[WP:EGG]
	regex(/\[\[((?:People's Republic of |)China|Canad(?:a|ians?)|Chinese|England|English|France|French|Germany?|Great\sBritain|British|Ireland|Irish|Ital(?:y|ians?)|Japan(?:ese|)|Russian?|Spain|Spanish|Swi(?:tzerland|ss))\]\]/gi, '$1');
	regex(/\[\[(?:(?:People's Republic of |)China|Canada|England|France|Germany|Great\sBritain|Ireland|Italy|New Zealand|Japan|Spain|United\sKingdom|U\.K\.|UK|United\sStates(?:\sof\sAmerica|)|US|U\.S\.|USA|U\.S\.A\.)\|(Chinese|Canadian|English|French|German|British|Irish|Italian|New Zealander|Japanese|Spanish|American|US)\]\]/gi, '$1');
	regex(/\[\[(?:British (?:nationality law|people)\||)(British|English|Scottish|Welsh|Northern Irish|UK|United Kingdom)\]\]/gi, '$1');
	regex(/\[\[(?:United\sStates(?:\sof\sAmerica|)\||)(?:USA?|U\.S\.(?:A\.|))\]\]/gi, 'US');
	regex(/\[\[(?:United\sStates(?:\sof\sAmerica|)\||)(United\sStates(?:\sof\sAmerica|))\]\]/gi, '$1');
	regex(/\[\[(?:United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|)\||)(U\.K\.|UK)\]\]/gi, 'UK');
	regex(/\[\[(?:United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|)\||)(Britain|British|United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|))\]\]/gi, '$1');
	regex(/\[\[(Australia|Brazil|(?:People's Republic of |)China|Canada|Chile|England|France|Germany|Great\sBritain|India|Ireland|Israel|Italy|Mexico|New Zealand|Japan|Spain|Sweden|Swizerland|United\sKingdom|U\.K\.|UK|United\sStates(?:\sof\sAmerica|)|US|U\.S\.|USA|U\.S\.A\.)\]\]/gi, '$1');
    regex(/\[\[(?:M[ée]xican(?:s| people)\||)(Mexican)\]\]/gi, '$1');

	regex(/\[\[((?:Arabic|Chinese|English|French|German|Italian|Japanese|Russian|Spanish|American)\slanguage)\]\]/gi, '$1');		//unpiped

//dab – removing unsuitably piped links
	regex(/(\[\[)director \(film\)\|/gi, '$1');

//time and seasons
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(age|epoch|era|times)\]\]/gi, '$1');
	regex(/\[\[Present\s\(time\)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(annual|da[iy]|month|(?:fort|)night|season(?:al|)|hour|minute|present|second|week|year|decade|century)([ -]?end|ly|s|)\]\]/gi, '$1$2');
	regex(/\[\[((Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)days?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day)\|(Mon|Tues?|Wed|Thurs?|Fri|Sat|Sun|M|Tu|W|Th|F|Sa|Su)(\.|)\]\]/gi, '$1$2');
	regex(/\[\[(morning|afternoon|midnight|noon|sunrise|sunset|dawn|dusk|twilight)\]\]/gi, '$1');
	regex(/\[\[(spring|summer|winter|autumn|fall)\]\]/gi, '$1');
	regex(/\[\[spring\s\(season\)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[autumn\|(fall)\]\]/gi, '$1');
    regex(/\[\[(?:(?:hour|minute|second)s?\||)((?:hr|min|sec)s?\.?)\]\]/gi, '$1');
// months
	regex(/\[\[(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');
	regex(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)( \(month\)|)\|([^\]]{1,30})\]\]/gi, '$1');
	regex(/\[\[(?:(?:1[789]|2[01]|[\w-]+)(?:th|st) century)\|([^\]]+?)\]\]/gi, '$1'); 	
	regex(/\[\[((?:1[789]|2[01]|[\w-]+)(?:th|st) century)\]\]/gi, '$1');

// simple words and numbers	
	regex(/\[\[(\d{1,3}(,\d{3})+)\]\]/gi, '$1');

// expressions in foreign languages	
	regex(/\[\[(ad (?:hoc|hominem|nauseum)|de facto|et al\.?|fait accompli|faux pas|prima facie|status quo)\]\]/gi, '$1');

//Chinese language linked template
	regex(/\{\{linktext\|([^\}aeiou]+)\|([^\}]+)\|([^\}]+)\|([^\}]+)\|([^\}]+)\|([^\}]+)\}\}/gi, '$1$2$3$4$5$6'); //linktext 6 parameters
	regex(/\{\{linktext\|([^\}aeiou]+)\|([^\}|]+)\|([^\}]+)\|([^\}]+)\|([^\}]+)\}\}/gi, '$1$2$3$4$5'); //linktext 5 parameters
	regex(/\{\{linktext\|([^\}aeiou]+)\|([^\}|]+)\|([^\}]+)\|([^\}]+)\}\}/gi, '$1$2$3$4'); //linktext 4 parameters
//	regex(/\{\{linktext ?(?:\|lang=zh(?:-han[st] ?)|)\|([^\}aáàâäǎăāãåąæéèėêëěĕēẽęẹioóòôöǒŏōõǫọőøœuü,]+)\|([^\}]+)\|([^\}]+)\|([^\}]+))}\}/gi, '$1$2$3$4'); //linktext 4 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han[st] ?)|)\|([^\}aáàâäǎăāãåąæéèėêëěĕēẽęẹioóòôöǒŏōõǫọőøœuü,]+)\|([^\}]+)\|([^\}]+)\}\}/gi, '$1$2$3'); //linktext 3 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han[st] ?)|)\|([^\}aáàâäǎăāãåąæéèėêëěĕēẽęẹioóòôöǒŏōõǫọőøœuü,]+)\|([^\}]+)\}\}/gi, '$1$2'); //linktext 2 parameters
	regex(/\{\{linktext ?(?:\|lang=zh(?:-han[st] ?)|)\|([^\}aáàâäǎăāãåąæéèėêëěĕēẽęẹioóòôöǒŏōõǫọőøœuü,]+)\}\}/gi, '$1'); //linktext 1 parameter
	regex(/(\{\{zh\|[cst]=(?:[^\}\|]+))(\}\})/gi, '$1|link=no$2'); 

// proper nouns
	regex(/\[\[((?:public |)holidays?)\]\]/gi, '$1');
	regex(/\[\[Christmas\|([^\]]+?)\]\]/gi, '$1'); 
	regex(/\[\[(Christmas|Easter|Labou?r|May)( day| eve|)\]\]/gi, '$1$2');
	regex(/\[\[(New year('s day|'s eve|))\]\]/gi, '$1');
	regex(/\[\[((?:Broadway|West End)(?:\sTheatre|)|Hollywood|Hollywood, California)\]\]/gi, '$1');
//	regex(/\[\[(?:Broadway|West End) theatre\|(Broadway|West End)\]\]/g, '$1'); 

// adjectives
	regex(/\[\[(contemporary)\]\]/gi, '$1');
	regex(/\[\[(inter-?disciplinary)\]\]/gi, '$1');
	regex(/\[\[((?:diagonal|horizontal|vertical)(?:ly|s|))\]\]/gi, '$1');

	regex(/\[\[(exile)\]\]/gi, '$1');

// people general, professions
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(chef|hair(?:dresser|[ -]?stylist))\]\]/gi, '$1');
	regex(/\[\[cook \(profession\)\|(cooks?|chefs?)\]\]/gi, '$1');
	regex(/\[\[(Consul General)\]\]/g, 'consul general');
	regex(/\[\[(Legislative Council)\]\]/g, 'legislative council');
	regex(/\[\[(?:vice[- ]chancellor\||)(vice[- ]chancellor)\]\]/gi, '$1');
	regex(/\[\[(?:(?:civil|mechanical|software|) ?engineer(?:ing|)\||)((?:civil|mechanical|software|) ?engineer(?:ing|))\]\]/gi, '$1');
	regex(/\[\[(apprentice(?:ship|)|archiv(?:ist|e)|arranger|art(?:ist|)|athlete|author|ballet|butcher|camera|campaign(?:er|)|career|comedian|composer|consul(?:ate|ar|tant|)|civilian|crew|(?:film |music |)critic|cultur(?:e|al)|curator|dentist|design(?:er|)|dj|(?:dis[ck] |)jockey|drawing|(?:music(?:al|) |)educator|[eé]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[dr]|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(/\[\[(?:publi(?:sher|shing|cation)\||)((?:book |)publi(?:shers?|shing(?: house| company)|cation))\]\]/gi, '$1');
	regex(/\[\[(?:sculpt(?:ors?|ing|ure)\||)(sculpt(?:ors?|ing|ure))\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:singer.|)song|)writ(?:ers?|ing)\||)((?:(?:singer.|)song[ -]?|)writ(?:er?s?|ten|ing)|sing(?:er|ing))\]\]/gi, '$1');
	regex(/\[\[(?:(?:edit(?:or|ing)|journalism)\||)(columnists?|edit(?:ed|ing|ors?)|editors?[ -]in[ -]chief|editorial|reporter|journalis[mt]s?)\]\]/gi, '$1');
	regex(/\[\[(interviews?|mentors?|pundits?)\]\]/gi, '$1');
	regex(/\[\[(taxi|cab(?: driver|bie|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:auto|)biography\||)((?:auto|)biograph(?:er|y|ical|ies))\]\]/gi, '$1');
	regex(/\[\[(?:philosophy\||)(philosoph(?:er|y|ical|ies))\]\]/gi, '$1');
	regex(/\[\[(?:science\||)(scien(?:ce|tific(?:ally)|tists?))\]\]/gi, '$1');
	regex(/\[\[(?:mathematics\||)(mathematic(?:s|ians?))\]\]/gi, '$1');
	regex(/\[\[(?:screenwrit(?:er|ing)\||)((?:screen|script|television|TV)[ -]?writ(?:ers?|ing))\]\]/gi, '$1');
	regex(/\[\[(?:(?:film |screen)writ(?:er|ing)\|)(writ(?:ers?|ing))\]\]/gi, 'screen$1');
	regex(/\[\[(?:(film |literary )edit(?:or|ing)\|)(edit(?:ors?|ing))\]\]/gi, '[[$1$2]]');
	regex(/\[\[(?:animat(?:ion|ors?)\||)(animat(?:ions?|ing|ors?))\]\]/gi, '$1');
	regex(/\[\[(?:carpentry\||)(carpent(?:ry|er))\]\]/gi, '$1');
	regex(/\[\[(?:critic(?:ism|)\||)(critic(?:ism|))\]\]/gi, '$1');
	regex(/\[\[(?:drama(?:tist|s?)\||)(dramas?|dramatists?)\]\]/gi, '$1');
	regex(/\[\[(mechanic|pharmacist|fisherman)\]\]/gi, '$1');
	regex(/\[\[(?:publi(?:cation|shing)\||)(publi(?:cation|shing|shers?))\]\]/gi, '$1');
	regex(/\[\[(?:photograph(?:er|y|)\||)(photograph(?:ers?|y|ic|s|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:orchestra |)conducting|conductor \(music\))\||)(conduct(?:ed|ing|ors?))\]\]/gi, '$1');
	regex(/\[\[(?:consultancy\||)((?:business |)consult(?:ancy|ing|ants?))\]\]/gi, '$1');
	regex(/\[\[(?:organ(?: \(music(?:al instrument|)\)|ist|)\||)(organ(?:ists?| music|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:build|paint|plumb)ing\||)((?:build|paint|plumb)(?:ing|er))\]\]/gi, '$1');
	regex(/\[\[(?:prostitution\||)(prostitut(?:es?|ion))\]\]/gi, '$1');
	regex(/\[\[(?:politic(?:s|ian)\||)(politic(?:s|al|ians?)|statesman)\]\]/gi, '$1');
	regex(/\[\[politician\|statesman\]\]/gi, 'politician');
	regex(/\[\[(?:professional sports\||)(professional|professional sports?)\]\]/gi, '$1');
	regex(/\[\[(?:amateur sports\||)(amateur|amateur sports?)\]\]/gi, '$1');
	regex(/\[\[(?:movie theater\||)(movie theat(?:re|er)s?|cinemas?)\]\]/gi, '$1');
	regex(/\[\[(?:retirement\||)(retir(?:e[drs]?|ement|ing))\]\]/gi, '$1');
	regex(/\[\[(?:[Cc]ivil\s[Ss]ervice\||)(?:[Cc]ivil\s[Ss]erv(ants?|ice))\]\]/g, 'civil serv$1');
	regex(/\[\[(cable |satellite |terrestrial |)(tv|television)\]\]/gi, '$1$2');
	regex(/\[\[(clothing|clothe?|cotton|denim|earring|fabric|footwear|garment|glove|hand ?bag|hat|helmet|jean|leather|legging|lingerie|silk|necklace|nylon|dress|tailor|(?:neck|)tie|shirt|sock|stocking|jacket|jewel(?:le|)ry|trouser|vest|watch|scarf|shoe|short|sunglasse?|suit|wig)\]\]/gi, '$1');
	regex(/\[\[(balm|eye.?liner|lip.?stick|mascara|perfume)\]\]/gi, '$1');
	regex(/\[\[(?:cosmetics\||)(make.?up|cosmetics)\]\]/gi, '$1');
	regex(/\[\[(?:(?:coats?|belts?)\(clothing\)\||)(coats?|belts?)\]\]/gi, '$1');
	regex(/\[\[(?:ring \(jewel(?:le|)ry\)\||)((?:diamond |engagement |gold |pinkie |wedding |)rings?)\]\]/gi, '$1');
	regex(/\[\[(captain|major|general|lieutenant|private)\]\]/gi, '$1');
	regex(/\[\[(?:(?:captain|colonel|major|general(?: officer|)|lieutenant|sergeant|private)(?: \([\w]*\)|)\||)(captain|colonel|major|general|lieutenant|sergeant|private)\]\](?= \[)/gi, '$1');
	regex(/\[\[musical theatre\|(music(?:al(?: theatre|theater|)s?))\]\]/gi, '$1'); 
	regex(/\[\[(beauty (?:competition|contest|pageant|queen))\]\]/gi, '$1');
	regex(/\[\[(answer|question|contest|contestant|game|pageant|pen)(s|)\]\]/gi, '$1$2');
	regex(/\[\[(?:competition\||)(competit(?:ions?|ive|ors?))\]\]/gi, '$1');

	regex(/(British )(\[\[(Conservative|Green|Labour|Liberal(?: Democrat|)) Party \(UK\)\|)(\3(?: Party|)\]\])/gi, '$2$1$4'); //retraining in necessary order

	regex(/\[\[(?:(?:dance|choreography)\||)(choreograph(?:e[dr]s?|y|)|dance[drs]?|dancing)\]\]/gi, '$1'); 
	regex(/\[\[(?:ballet\||)(ballet (?:dance[drs]?|dancing))\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:(?:p[ar]int|writ)ing|illustration)\||)(p[ar]int|writ|illustrat)(ed|[eo]rs?|ings?)\]\]/gi, '$1$2'); 

	regex(/\[\[(bicycle|bike|boat|ferry|engine|motor(?:cycle|ing| car|)|ship|truck|tyre|van|vehicle|wheel)\]\]/gi, '$1');
	regex(/\[\[(?:Vehicle registration plate\||)(number plates?)\]\]/gi, '$1'); 
	regex(/\[\[(car|van)\]\]/gi, '$1'); //false positive for 'Vans' clothing brand
//	regex(/\[\[(foo bar)\]\]/gi, '$1'); 
	regex(/\[\[(equipment|instrument|machine|tool)\]\]/gi, '$1');
	regex(/(\W\s+)\[\[(?:Ship naming and launching\|)(launched)\]\]/gi, '$1$2');

//business & legal
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(?:(?:chair \(official\)|chairman)\||)((vice[- ]|)chair(?:man|woman|person|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:chair \(official\)|chairman|master of ceremonies)\||)(chair(?:ed|ing|s|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:president \(corporate title\)|president)\||)((?:vice[- ]|)president)\]\]/gi, '$1');
	regex(/\[\[(contracts?|director|intellectual property|judge|patent|(?:vice[- ]|)president|real[- ]estate(?: broker| agent|)|regulation|taxe?|taxation|trademark|treasurer)\]\]/gi, '$1');
	regex(/\[\[(legisla(?:tion|tive assembl[iy]e?|tive council|ture))\]\]/gi, '$1');
	regex(/\[\[(?:accountancy\||)(account(?:ant|ing))\]\]/gi, '$1'); 
	regex(/\[\[(?:business\||)((?:business|enterprise)(?:e?s|))\]\]/gi, '$1'); 
	regex(/\[\[(?:business(?:person|people|)\||)(business(?: ?(?:wo)?m[ae]n| executive| ?person|es|)|corporate executive)\]\]/gi, '$1'); 
	regex(/\[\[(secretary|personal assistant)\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:law|lawyer)\||)(attorney|laws?|lawyers?|(?:il|)legal(?:ly|))\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:lawsuit)\||)(sue[sd]?)\]\]/gi, '$1'); 
	regex(/\[\[(courts?)\]\]/gi, '$1'); 
	regex(/\[\[(?:board of directors\||)(board|(?:board of |)directors)\]\]/gi, '$1'); 
	regex(/\[\[((?:creative|film|managing|movie|musical|personnel) director)\]\]/gi, '$1'); 
	regex(/\[\[(?:entrepreneur(?:ship|)\||)(entrepreneu(?:r|se)s?|founders?)\]\]/gi, '$1'); 
	regex(/\[\[(?:film|movie) director\|D(irector)\]\]/gi, 'd$1'); 
	regex(/\[\[(?:film[ -]?making\||)(film[ -]?mak(?:ers?|ing))\]\]/gi, '$1'); 
	regex(/\[\[(?:management\||)((?:general |)manag(?:e[ds]?|ement|ing|ers?))\]\]/gi, '$1'); 
	regex(/\[\[(?:managing director\||)(MD)\]\]/gi, '$1'); 
	regex(/\[\[((?:private(?:ly held|) |public |listed |quoted |)(?:compan(?:ies|y)|corporations?))\]\]/gi, '$1');
	regex(/\[\[((?:private(?:ly[- ]held|) |public |listed |quoted )compan(?:ies|y))\|(private|public|listed|quoted)\]\]/gi, '$1');
	regex(/\[\[(?:vice president(?:#in business|)\||)((?:executive |E|senior |)(?:vice president|VP))\]\]/gi, '$1'); 
	regex(/\[\[(?:chief executive officer\||)(CEO|C\.E\.O\.|(?:chief |)executive(?: officer)?)\]\]/gi, '$1'); 
	regex(/\[\[(?:chief (?:financial|operating) officer\||)(C[FO]O|C\.[FO]\.O\.|chief (financial|operating) officer)\]\]/gi, '$1'); 
	regex(/\[\[(credit card|investments?|loans?|mortgage|savings)\]\]/gi, '$1');
	regex(/\[\[(headquarter|officer?|official)\]\]/gi, '$1');
	regex(/\[\[(?:bankruptcy\||)(bankrupt(?:cy|cies|))\]\]/gi, '$1'); 
	regex(/\[\[(?:resignation\||)(resign(?:ed|ing|ations?|s|))\]\]/gi, '$1'); 
	regex(/\[\[(?:recording contract\||)(recording (?:deal|contract))\]\]/gi, '$1'); 
	regex(/\[\[(?:strategy\||)(strateg(?:y|ies|ic|ically))\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:trade|trading|commerce)\||)(trade|trading|commerce|commercial)\]\]/gi, '$1'); 
	regex(/\[\[(non.commercial)\]\]/gi, '$1'); 
	regex(/\[\[(?:startup(?: company|)\||)(startup)\]\]/gi, '$1'); 
	regex(/\[\[(?:invasion\||)(invad(?:e[sd]?|ions?))\]\]/gi, '$1'); 
	regex(/\[\[(?:translation\||)(translat(?:e[sd]?|ions?))\]\]/gi, '$1'); 
	regex(/\[\[(?:customs\||)(customs(?: duty| duties| officer| service| tax|))\]\]/gi, '$1'); 
    regex(/\[\[((?:customer|worker)s?)\]\]/gi, '$1'); 

// buildings structure and environment	
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(bath|bed|ceiling|chair|fixture|fitting|gym|kitchen|laundry|shower|(?:swimming |)pool|table|toilet|wall)\]\]/gi, '$1');
	regex(/\[\[((?:bath|bed|dining|living) ?room)\]\]/gi, '$1');
	regex(/\[\[(arena|architect(?:ure|)|cafeteria|carpet|car park|cathedral|chapel|construction|fa[cç]ade|floor|furniture|garden(?:ing|)|hospital|home|residen(?:ce|t)|[hm]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(/\[\[(?:(?:health club|hotel|leisure centre|night club|Sport(?:(?:s|ing) (?:complex|club))|stadium|(?:Town |)hall)\|)([^\]]+)\]\]/gi, '$1'); 
	regex(/\[\[(?:shopping (?:arcade|mall|centre|center)\||)((?:shopping |)(?:arcade|centre|center|mall)(?:s|))\]\]/gi, '$1');
	regex(/\[\[(?:church \(building\)\||)(church)(es|)\]\]/gi, '$1$2'); 
	regex(/\[\[(brick|building|composite|cement|concrete|environment|foundation|glass|steel|structure|wood)\]\]/gi, '$1');
	regex(/\[\[(flat|apartment|room)\]\]/gi, '$1');
	regex(/\[\[(?:garage \(house\)\||)(garages?)\]\]/gi, '$1'); 
	regex(/\[\[(dam|port|bridge|station|pedestrian|reservoir|road|street|traffic|tunnel|underground|(?:high|free|motor)way)\]\]/gi, '$1');
	regex(/\[\[((?:high|mid|medium|low)[- ]?rise)\]\]/gi, '$1');
	regex(/\[\[(?:residential area\||)((?:residential)(?: areas?|))\]\]/gi, '$1');
	regex(/\[\[(?:headquarters\||)(headquarters|headquartered)\]\]/gi, '$1');
	regex(/\[\[(?:central business district\|)(CBD|central business district|down[ -]?town)\]\]/gi, '$1');
    regex(/\[\[(CBD|central business district|down[-]?town)\]\]/gi, '$1');
	regex(/\[\[((?:bus|metro|railway|train|tube|underground)(?: line| stop| station|))\]\]/gi, '$1');
	regex(/\[\[(?:bus|metro|railway|train|tube|underground)(?: stop| station)\|(station)\]\]/gi, '$1');
	regex(/\[\[(public buildings?|castle|fortress)\]\]/gi, '$1');

	regex(/\[\[(?:environmentalism\||)(environment(?:al(is[mt]|)))\]\]/gi, '$1');
//	regex(/\[\[(foobar)\]\]/gi, '$1');

// earth science nouns 
	regex(/\[\[(Earth)\]\]/gi, '$1');
	regex(/\[\[(animal|insect|plant)(s|)\]\](?![ai])/gi, '$1$2');
	regex(/\[\[(cattle|meat|timber|livestock|milk|dairy(?: produce|)|vegetables?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:hu|wo|)man)\||)((?:hu|wo|)m[ae]n)\]\]/gi, '$1');
	regex(/\[\[(alligator|baboon|bat|bear|bird|bull|(?:black |)cat|camel|cheetah|chicken|crab|crocodile|dinosaur|dog|dolphin|donkey|duck|eel|elephant|cow|fish|fox|frog|sheep|goat|goldfish|goose|gorilla|human|pig(?:eon|)|horse|jellyfish|lizard|monkey|mouse|mice|octopus|ostrich|owl|parrot|penguin|pet|puppy|(?:sea ?|)lion|rabbit|rat|raven|reptile|seal|shark|snake|spider|squirrel|tiger|turtle|elephant|giraffe|vulture|whale|worm|zebra)(s|)\]\]/gi, '$1$2');
	regex(/\[\[columbidae\|(pigeons?)\]\]/gi, '$1');
	regex(/\[\[turkey \(bird\)\|(turkeys?)\]\]/gi, '$1');
	regex(/\[\[(?:horse racing\||)(horses?)\]\]/gi, '$1'); //WP:EGG
	regex(/\[\[(beach|cave|cliff|earthquake|forest|grass|hill|island|lagoon|land|lake|mountain|ocean|pond|river|sea|stream|tree|vegetation|weed)\]\]/gi, '$1');
	regex(/\[\[(altitude|elevation|sea level|[hw]eight)\]\]/gi, '$1');
	regex(/\[\[(solid|liquid|gase?)\]\]/gi, '$1');
	regex(/\[\[(metal|min(?:ing|e|eral)|gold|iron|iron ore|copper|diamond|mineral sands|coal|lead|logging|oil|natural gas|silver)\]\]/gi, '$1');
	regex(/\[\[(?:mining\||)(mines?)\]\]/gi, '$1');
	regex(/\[\[(plastic|rubber)\]\]/gi, '$1');
	regex(/\[\[(?:recycling\||)(recycl(?:e[sd]|ing))\]\]/gi, '$1');
	regex(/\[\[(?:alumini?um\||)(alumini?um)\]\]/gi, '$1');

// tech
	regex(/\[\[(addresse?|digit|file|(?:sur|fore|first |last |nick|)name|number|sign(?:ature|)|word|letter|sentence)\]\]/gi, '$1');
	regex(/\[\[(blog(?:ger|)|broadband|(?:e-?|)mail|computer|data|personal\scomputer|PC|laptop|laptop\scomputer|(?:cell|cellular|mobile|portable|tele|)[- ]?phone|MP[34] player|digital audio player|technology|(?:computer |)(?:application|hardware|program|software)|(?:computer |video |)game)\]\]/gi, '$1');
	regex(/\[\[(computer|high|information)( technology|)\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:SMS|text messaging)\||)(SMS|texting|text messag(?:es?|ing))\]\]/gi, '$1');

// economy
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(bank(?:ers?|ing|s|)|capital|cargo|(?:un|)employ(?:e[der]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(/\[\[(credit(?: card|)|pension|welfare)\]\]/gi, '$1');
	regex(/\[\[(?:finance\||)(financ(?:e|ial|ing|ier))\]\]/gi, '$1');
	regex(/\[\[(?:wealth\||)(wealthy?)\]\]/gi, '$1');
	regex(/\[\[(?:partnership\||)(partner(?:ed|ing|ship|)s?)\]\]/gi, '$1');
	regex(/\[\[gross domestic product\|(GDP)\]\]/gi, '$1');
	regex(/\[\[(?:(?:radio |tv |television |)(?:advert(?:isement|)|commercial|special|network)\||)((?:radio |tv |television |)(?:advert(?:isement|)|commercial|special|network|radio|tv|television))\]\]/gi, '$1');
	regex(/\[\[television\|(tv|television)\]\]/gi, '$1');
	regex(/\[\[(online|Internet)\]\]/gi, '$1');
	regex(/\[\[(?:demonstration \(people\)\||)(demonstrators?|protest(?:er|)s?)\]\]/gi, '$1');
	regex(/\[\[(?:strike action\||)(strik(?:e action|es|ing))\]\]/gi, '$1');
	regex(/\[\[(?:(?:full|part)[- ]time\||)((?:full|part)[- ]time(?: employment| job| work|))\]\]/gi, '$1');

	regex(/\[\[(?:electricity\||)(electric(?:ity|al|))\]\]/gi, '$1');
	regex(/\[\[(?:sales\||)(sales?|salesm[ae]n|sell(?:er|ing|s|)|sold)\]\]/gi, '$1');
	regex(/\[\[(assault|awards?|clubs?|colou?rs?|confectionery|cosmetic|down[ -]?town|fire|flowers|gambling|gas(?:oline|)|heating|ice|income|information|institut(?:e|ion)|inventor|jobs?|li[fv]e|magazines?|mosque|(?:news|)papers?|prizes?|publicity|organi[sz](?:e|ation)|department|petrol|plastic|(?:air |)pollution|product|salary|school|smog|subsidiar(?:y|ie)|supermarket|synthesi[sz]er|synagog(?:ue|)|team|television|(?:tv |television |)network|temple|textile|time(?:line|)|wage|water|website|win)(s|)\]\]/gi, '$1$2'); 
	regex(/\[\[(?:(?:stage \((?:theater|theatre)\)|theater|theatre)\||)(stages?|theaters?|theatres?)\]\]/gi, '$1');
	regex(/\[\[(advertis(?:ing|ement)|brand|creativity|consumer|promot(?:ing|ion|e[sd]?)|market(?:ing|)|sign(?:age|))(s|)\]\]/gi, '$1$2');
	regex(/\[\[(logo)\]\]/g, '$1'); 	//'Logos' is a separate word from logo
	regex(/\[\[(fruit|apple|banana|garlic|grape|lemon|melon|pear|pumpkin|tomato|peanut)\]\]/g, '$1');
	regex(/\[\[(meat|beef|poultry|pork|seafood|butter|candy|cereal|corn|flour|grain|lettuce|wheat|maize|pasta|pastry|pepper|rice|salt|sugar|tobacco|vinegar)\]\]/gi, '$1');
	regex(/\[\[(breakfast|lunch|dinner|supper|food|drink|herb|spice|beverage|biscuit|dessert|tea|chocolate|coffee|juice|carrot|onion|potatoe?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:agriculture|horticulture)\||)((agri|horti)(culture|cultural))\]\]/gi, '$1');
	regex(/\[\[orange \(fruit\)\|(oranges?)\]\]/gi, '$1');
	regex(/\[\[(cooking|recipe|oven)\]\]/gi, '$1');
	regex(/\[\[((?:tele|)communic(?:ations?|ate))\]\]/gi, '$1');
	
	regex(/\[\[(air(?:craft|line|plane|port|)|ambulance|aviation|bus|invasion|logistics|transport(?:ation|)|train|tram|)\]\]/gi, '$1');
	regex(/\[\[(?:aircraft pilot\||)((?:air(craft|line) |)pilot)\]\]/gi, '$1');
	regex(/\[\[(exploration|trad(e|ing)|shipping|outsourcing)\]\]/gi, '$1');
	regex(/\[\[(?:rail transport\||)(rails?|railways?|rail transport|railroads?)\]\]/gi, '$1');
	regex(/\[\[(?:aviat(?:or|ion)\||)(aviat(?:ors?|ion)|pilots?)\]\]/gi, '$1');

	regex(/\[\[(?:retail(?:er|ing|)\||)(retail(?:er|ing|)|(?:retail |)shop)\]\]/gi, '$1');
	regex(/\[\[(\w+ (?:school|shop))\]\]/g, '$1');
	regex(/\[\[(?:wholesale(?:r|)\||)(wholesale(?:r|))\]\]/gi, '$1');
	regex(/\[\[(?:econom(?:ics|y)\||)(econom(?:ical|ics?|ists?|y))\]\]/gi, '$1');
	regex(/\[\[(?:economic growth\||)((?:economic |)growth)\]\]/gi, '$1');
	regex(/\[\[(?:statistics\||)(statistics?|statisticians?|statistical)\]\]/gi, '$1'); 
	regex(/\[\[(profit(?:able|ability|s|))\]\]/gi, '$1');
	regex(/\[\[((im|ex)(port(?:er|ing|s|)))\]\]/gi, '$1');
	regex(/\[\[((immi|emi)(grate[sd]|gration))\]\]/gi, '$1');
	regex(/\[\[(?:(?:factory|manufacturing)\||)(factor(?:y|ies)|manufactur(?:er?|ing(?: plant|)))\]\]/gi, '$1');
	regex(/([^\*] *)\[\[(coal min(e[rs]?|ing))\]\]/gi, '$1$2');
	regex(/\[\[(?:farming\||)(farm(er|s|ing|))\]\]/gi, '$1');
	regex(/\[\[(?:history\||)(histor(?:ical|ians?|ies|y))\]\]/gi, '$1');
	regex(/\[\[(?:geography\||)(geograph(?:ical|ers?|ies|y))\]\]/gi, '$1');
	regex(/\[\[(?:geology\||)(geolog(?:ical|ists?|ies|y))\]\]/gi, '$1');
	regex(/\[\[(?:psychology\||)(psycholog(?:ical|ists?|y))\]\]/gi, '$1');
	regex(/\[\[(?:physics\||)(physic(?:al|ists?|s))\]\]/gi, '$1');
	regex(/\[\[(baker|grocer)(ies|y|)\]\]/gi, '$1$2');
	regex(/\[\[(beauty (?:parlour|salon)|confectioner|convenience store|florist|gift(?: shop|)|green ?grocer|hardware store|hair ?dresser|newsagent)\]\]/gi, '$1');
	regex(/\[\[(?:self.service laundry\||)(laundr(?:ette|omat|y))\]\]/gi, '$1');

	regex(/\[\[(?:non-?profit\sorgani[sz]ation\||)(non-?profit\sorgani[sz]ations?|non-?profit)\]\]/gi, '$1');
	regex(/\[\[(?:non-?(?:governmental|profit)\sorgani[sz]ation\||)(non-?(?:governmental|profit)\sorgani[sz]ation|NGO)\]\]/gi, '$1');
	regex(/\[\[(?:(?:charity \(practice\)|charitable\sorgani[sz]ation)\||)(charitable\sorgani[sz]ations?|charit(?:able|ies|y))\]\]/gi, '$1');
	regex(/\[\[(post(?:\s?code| office|))\]\]/gi, '$1');

// weather and climate
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(cloud|drought|rain(?:fall|)|snow|storm|weather|flood(?:ing|))\]\]/gi, '$1');
	regex(/\[\[(?:tropics\||)(tropics?|tropical)\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:ec|ge)ology\||)((?:ec|ge)olog(?:ical|ists?|y))\]\]/gi, '$1');
	regex(/\[\[(experiment|laborator(?:ie|y)|temperature)\]\]/gi, '$1');
	regex(/\[\[(?:Cel[cs]ius\||)((?:(?:degree|°)?\s?(?:\s|-|&nbsp)|)Celsius)\]\]/gi, '$1'); 
	regex(/\[\[(?:Farenheit\||)((?:(?:degree|°)?\s?(?:\s|-|&nbsp)|)Farenheit)\]\]/gi, '$1'); 
	regex(/\[\[((?:degree|°)\s?(?:\s|-|&nbsp)[CF])\]\]/gi, '$1'); //delink temperature in redirect
//delink full temperature in redirect
	regex(/\[\[(?:degree|°)?\s?(?:\s|-|&nbsp)(?:Cel[cs]ius|Fahrenheit|C|F)\|([^\]]+?)\]\]/gi, '$1');
	regex(/(\d)(?:\s|-|&nbsp|)(degree|°)(?:\s|-|&nbsp|)\[\[(?:Cel[cs]ius|Fahrenheit|C|F)\|(C|F)\]\]/gi, '$1&nbsp;$2$3');

// measurements and perception
//	regex(/\[\[(foobar)\]\]/gi, '$1');

	//Template:{{convert}}, {{height}}
//delink within convert template: optional square and cubes; optional per unit time; optional range
	regex(/(\{\{convert\|[\d\.,]+?(?:\|(?:to|by|and|-))?(?:\|[\d\.,]+?)?\|(?:(?:sq|cu)?(?:ins?|ft(?:in|)|yds?|mi|[mck]?m)[23²³]?)(\/(?:s|sec|min|h))?(?:\|(?:sq|cu)?(?:in|ft(?:in|)|yds?|mi|[mck]?m)[23²³]?(\/(?:[sh]|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\|[\d\.,]+?(?:\|(?:to|by|and|-))?(?:\|[\d\.,]+?)?\|(?:acres?|ha|kgs?|lbs?|hp|[mck]?w|°?[CF]|mph)(\/(?:[sh]|min))?(?:\|(?:acre|ha|kg|lb|hp|[mck]?w|°?[CF]|mph)(\/(?:[sh]|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(/\[\[((?:linea[rl]|square|sq|cubic|cu)?\s?(?:milli|centi|kilo|)met(?:er|re)s?)\]\]/gi, '$1');
	regex(/\[\[(?:linea[rl]|square|sq|cubic|cu)?\s?(?:milli|centi|kilo|)met(?:er|re)s?\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(milli|centi|kilo|)(gram)(?:me)?\]\]/gi, '$1$2');
	regex(/\[\[(?:milli|centi|kilo|)gram(?:me)?s?\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[((?:milli|centi|deci|hecto|kilo|)lit(?:er|re)s?)\]\]/gi, '$1');
	regex(/\[\[(?:milli|centi|deci|hecto|kilo|)lit(?:er|re)s?\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[((?:milli|centi|kilo|)watts?)\]\]/gi, '$1');
	regex(/\[\[(?:milli|centi|kilo|)watt?s?\|([^\]]+?)\]\]/gi, '$1');
	regex(/(\{\{pop\sdensity\s(?:km2|mi2)to\s(?:km2|mi2)[^\}]*?)\|\s?wiki=(?:yes|no)/gi, '$1');

	regex(/\[\[((?:linear|square|sq|cubic|cu)?\s?(?:inch|inches|foot|feet|miles?|ins?|ft|yard|yd)\s?\(?(?:unit\sof\s?)?(?:unit|length|measure|measurement)?\)?)\]\]/gi, '$1');
	regex(/\[\[(?:linear|square|sq|cubic|cu)?\s?(?:inch|inches|foot|feet|miles?|ins?|ft|yard|yd)\s?\(?(?:unit\sof\s?)?(?:unit|length|measure|measurement)?\)?\|([^\]]+?)\]\]/gi, '$1');

	regex(/\[\[(add|addition|average|difference|mean|sum|total)\]\]/gi, '$1');
	regex(/\[\[(acre|hectare|pound)\]\]/gi, '$1');
	regex(/\[\[(cold|energy|heat|light|sound|temperature)\]\]/gi, '$1');
	regex(/\[\[(?:(?:monaural|stereophonic sound)\||)(mono|monaural|stereophonic sound|stereo)\]\]/gi, '$1');

// colours
//	regex(/\[\[(foo|fooo)(bar)\]\]/gi, '$1$2');
	regex(/\[\[(strawberry |platinum |)(blonde?)\]\]/gi, '$1$2');
	regex(/\[\[(?:blonde?\||)(blond hair)\]\]/gi, '$1');
	regex(/\[\[(light.|dark.|)(beige|black|brown|blue|crimson|gr[ae]y|green|maroon|orange|pink|purple|red|violet|white|yellow)\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:royal.|navy.)blue\||)(royal.|navy.)(blue|)\]\]/gi, '$1$2');
	regex(/\[\[(?:grey\||)(gr[ae]y)\]\]/gi, '$1');
	regex(/\[\[[^\(\[\]]* \(colou?r\)\|([^\]]*)\]\]/gi, '$1');
	regex(/\[\[(?:shades of (?:black|blue|brown|cyan|green|gr[ae]y|magenta|orange|pink|red|violet|white|yellow)[^|]+\|)(\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[ ]\[\[(Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|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|West Virginia|Wisconsin|Wyoming)\]\]/gi, '$1 of $2]]');
	regex(/(\[\[(?:[^\]]{1,20})[ ]of[ ](?:Georgia|Washington)\|[^\]]{1,20})\]\][ ](?:of the (?:U\.? ?S\.? |)state |)of[ ]\[\[(?:Georgia|Washington) \(U\.? ?S\.? state\)\|(Georgia|Washington)\]\]/gi, '$1 of $2]]');

//chained office-holders
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[((?:Chief|Foreign|Prime|Interior|Treasury|Finance) Minister|(?:Vice[-\s]|)President) of ([^|\]]+)\|\1\]\] of \[\[\2\]\]/gi, '[[$1 of $2]]');
	regex(/\[\[(Secretary General)( of the )([^|\]]+)\|\1\]\]\2(?:\[\[\3\]\]|\3)/gi, '[[$1$2$3]]');
	regex(/\[\[(?:(?:Foreign|Prime|Interior|Treasury|Finance) Minister of |List of (?:Foreign|Prime|Interior|Treasury|Finance) Ministers of )(?:Abkhazia|Afghanistan|Albania|Algeria|Angola|Antigua and Barbuda|Armenia|Aruba|Australia|Azerbaijan|(?:the |)Bahamas|Bahrain|Bangladesh|Barbados|Belgium|Belize|Bhutan|Bosnia and Herzegovina|Brazil|Bulgaria|Burkina Faso|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Congo|(?:the |)Cook Islands|Croatia|Cuba|(?:the |)Czech Republic|Denmark|Djibouti|Dominica|East Timor|Egypt|Equatorial Guinea|Estonia|(?:the |)Faroe Islands|Fiji|Finland|France|Georgia|Ghana|Greece|Greenland|Grenada|Guinea|Guyana|Haiti|Hungary|Iceland|India|Indonesia|Iran|Iraq|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lithuania|Luxembourg|Macedonia(?: FYRO|)|Malaysia|Malta|Mauritius|Moldova|Mongolia|Montenegro|Morocco|Myanmar|Burma|Nagorno-Karabakh|Namibia|Nepal|(?:the |)Netherlands|(?:the |)Netherlands Antilles|New Zealand|Northern Cyprus|Pakistan|(?:the |)Palestinian National Authority|Palestine|Papua New Guinea|Per[uú]|(?: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)\|((?:[\w]* |)(?:Agriculture|Commerce|Defen[cs]e|Education|Employment|Energy|Foreign|Health|Labou?r|Prime|Interior|Trade|Transport|Treasury|Finance) minister)\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[((?:United States|U\.?S\.?) Secretary of (?:Agriculture|Commerce|Defense|Education|Energy|Health and Human Services|Homeland Security|Housing and Urban Development|the Interior|Labor|Transportation|the Treasury))\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[(?:(?:United States|U\.?S\.?) Secretary of (?:Agriculture|Commerce|Defense|Education|Energy|Health and Human Services|Homeland Security|Housing and Urban Development|the Interior|Labor|Transportation|the Treasury)\||)((?:US |U\.?S\.? |)(?:Agriculture|Commerce|Defense|Education|Energy|Health|Homeland Security|Housing|Interior|Labor|Transportation|Treasury) secretary)\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[(?:(?:United States|U\.?S\.?) Secretary of State\||)((?:US |U\.?S\.? |)Secretary of State)\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[(?:Secretary-General of the United Nations\||)((?:UN |U\.?N\.? |)Secretary General)\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[(?:Vice |)President of the United States\|((?:U\.S\. |US |Vice |)President)\]\](,? \[\[)/gi, '$1$2');
	regex(/\[\[(?:Vice |)President of [^|\]\}]+\|([^\]]*President[^\]]*)\]\](,? \[\[)/gi, '$1$2');
//	regex(/\[\[(?:Deputy |)Prime minister of [^|\}]+\|([^\]]*Prime minister[^\]]*)\]\](,? \[\[)/gi, '$1$2'); //deactivated 17/3/17 due to false positive in Mark Rutte article
	regex(/\[\[[^\]|]+\|([^\]|]+minister)\]\](,? \[\[)/gi, '$1$2');

	regex(/\[\[Irish people\|(Irish)\]\] \[\[(?:Irish |)(national|republican)(?:ism|)\|\2(ist|)\]\]/gi, '[[$1 $2ism|$1 $2$3]]');
	regex(/(Irish) \[\[(?:Irish |)(national|republican)(?:ism|)\|\2(ist|)\]\]/gi, '[[$1 $2ism|$1 $2$3]]');
//	regex(/\[\[(foo|fooo)(bar)\]\]/gi, '$1$2');
//	regex(/\[\[(British|U[KS]|U.[KS].|United States|)( army| armed forces| navy| air force)\]\]/gi, '$1$2');
	regex(/\[\[(advocacy|driv(er\'s|ing) licen[cs]e|passport|propaganda)\]\]/gi, '$1');
	regex(/\[\[(?:advocacy\||)(advocate)\]\]/gi, '$1');
	regex(/\[\[(?:propaganda\||)(propagandist)\]\]/gi, '$1');
	regex(/\[\[(?:(?:nation|nationality)\||)(nations?|(?:inter|)national|nationality)\]\]/gi, '$1'); 
	regex(/\[\[(ambassador|dictator(?:ship|)|emperor|empress|empire|imperial|prince(?:sse?|)|(?:prime |)minister|MP|general secretary|secretary(?: of state|)|govern(?:or|ment))\]\]/gi, '$1');
	regex(/\[\[(?:(?:member of parliament|MP|legislator)\||)(members? of parliament|members?|legislator)\]\]/gi, '$1');
	regex(/\[\[(?:(?:monarchy?|sovereign)\||)(king(?:dom|s|)|monarch(?:ies|s|y|)|queen)\]\]/gi, '$1');
	regex(/\[\[(?:speaker \(politics\)\||)(speaker)\]\]/gi, '$1');
	regex(/\[\[(?:Western world\||)((?:The |)West(?:ern|erner|ern world|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:cabinet|executive|minister) \(government\)\||)(cabinet|executive|minister)\]\]/gi, '$1');
	regex(/\[\[(?:Illegal drug trade|drug traffic(?:king|))\|([^\]]*)\]\]/gi, '$1');
	regex(/\[\[(?:capital (?:city|\(political\))\||)(capital(?: city|))\]\]/gi, '$1');
	regex(/\[\[(human rights|morals?|ethic(?:al|s))\]\]/gi, '$1');
	regex(/\[\[(north|south|east|west|left|rights?)\]\]/gi, '$1');
	regex(/\[\[(?:immigration\||)(immigra(tion|te[ds]?|nts?))\]\]/gi, '$1');
	regex(/\[\[(alliance|appeal|boycott|bribe(?:ry|)|census|citizen|constitution|coup(?: d['’][ée]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(/\[\[(?:local government\||)(local (?:authority|council))\]\]/gi, '$1');
	regex(/\[\[population density\|(density)\]\]/gi, '$1');
	regex(/\[\[(air[- ]force|armed forces|army|navy|defen[cs]e)\]\]/gi, '$1');
	regex(/\[\[(?:d(?:emocr|iplom)acy\||)(d(?:emocr|iplom)(ats?|acy|atic(?:ally|)))\]\]/gi, '$1');
	regex(/\[\[(?:municipality\||)(municipal(ity|ities|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:assassinat|elect|persecut)ion\||)((?:assassinat|elect|persecut)(e[drs]?|ion))\]\]/gi, '$1');
	regex(/\[\[(?:industr(?:y|iali[sz]ation)\||)((?:de-?|post-|)industr(?:y|ial(?:ists?|)|iali[sz](?:ation|e[ds])))\]\]/gi, '$1');
	regex(/\[\[(?:nomination\||)(nomin(ate[drs]?|ation|ee))\]\]/gi, '$1');
	regex(/\[\[(arm|colon|democrac|ecolog|econom|industr|(?:para|)militar|monarch|monopol|nav|oligopol)(ies|y)\]\]/gi, '$1$2');
	regex(/\[\[(?:colony|colonialism)\|(colon(?:ial|iali[sz]ation|ialism|ies|y))\]\]/gi, '$1');
//	regex(/\[\[(?:(?:capital|fasc|national|social|terror)ism\||)((?:capital|fasc|national|social|terror)is[mt]s?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:bi|multi)-?lateralism\||)((?:bi|multi)-?lateral(?:ism|))\]\]/gi, '$1');
	regex(/\[\[(?:patriotism\||)(patriot(?:ic|ism|s|))\]\]/gi, '$1');
	regex(/\[\[(?:conservatism\||)(conservat(?:ism|ive))\]\]/gi, '$1');
	regex(/\[\[(?:liberalism\||)(liberal(?:ism|s|))\]\]/gi, '$1');
	regex(/\[\[(?:anarchy\||)(anarch(?:ist(?:s|tic|)|y|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:human|author)itarianism\||)((?:human|author)itarian(?:ism|))\]\]/gi, '$1');
	regex(/\[\[(?:opinion poll\||)((?:opinion |)(?:polls?|polling|pollsters?))\]\]/gi, '$1');
	regex(/\[\[(?:political (?:censorship|corruption|party)\||)(political |)(censorship|corrupt(?:ion|)|party|parties)\]\]/gi, '$1$2');
	regex(/\[\[controversy\|(controvers(?:ial|y))\]\]/gi, '$1');
	regex(/\[\[(decree[s|d]?)\]\]/gi, '$1');
	regex(/\[\[(?:Names for United States citizens|People of the United States)\|(American)\]\]/gi, '$1');
	regex(/\[\[(?:USA?|United States(?: of America|)|U\.S\.)\|([^\]]{8})\]\]/gi, '$1');
	regex(/\[\[(?:Australian) dollars\|A?\$\]\]\$?/gi, 'A$');
	regex(/\[\[(?:New Zealand) dollars\|(?:NZ|)\$\]\]\$?/gi, 'NZ$');
	regex(/\[\[((?:Australian|New Zealand)\sdollars?|(?:A|NZ)\$)\]\]/gi, '$1'); 
	regex(/\[\[(USD|US$|U\.?S\.? dollars?|United States dollars?)\|(?:US[$$]|USD|[$$])([^\]]*)\]\]\]\]/gi, 'US$$1');
	regex(/\[\[(USD|US$|U\.?S\.? dollars?|United States dollars?)\|([^\]]+?)\]\]\$/gi, '$1');
	regex(/\[\[dollar(?: sign|s|)\|((?:US|)\[$$])\]\]?/gi, '$1');
	regex(/\[\[(?:(?:Euro|Eur|€)\||)(Eur|€)\]\]\$?/gi, '$1');
	regex(/\[\[((US|United States|U\.S\.)\sdollars?|USD|US[$$]|[$$])\]\]/gi, '$1'); 
	regex(/\[\[(United Nations)\]\]/gi, '$1');
	regex(/\[\[(?:United Nations\||)(UNO?|U\.N\.(?:O\.)?)\]\]/g, 'UN');
	regex(/(?:United Nations|UN|U\.N\.|UNO|U\.N\.O\.) \[\[(United Nations|U.N.) (General Assembly|Secretar(?:iat|y General))\|(?:General Assembly|Secretar(?:iat|y General))\]\]/g, '[[$1 $2]]');

	regex(/\[\[(?:World War I|World War II)\|(World War One|World War Two|First World War|Second World War|WWII?|The Great War)\]\]/g, '[[$1]]');
	regex(/\[\[(?:World War I|World War II)\|(first|second)\]\]/g, '$1');
//	regex(/\[\[(World War I|World War II|World War One|World War Two|First World War|Second World War|WWI|WWII)\]\]/g, '$1');
	regex(/\[\[(?:military rank\||)(military rank|rank)\]\]/g, '$1');

	regex(/\[\[Olympic Games\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:European\sUnion\||)(European\sUnion|EU|E\.U\.)\]\]/g, '$1');
	regex(/\[\[(Vice |)(President of the United States|President of the United States of America|POTUS)\]\]/gi, '$1$2');
	regex(/\[\[((?:United States|U\.S\.|US) (?:Vice[ -]|)President)\]\]/gi, '$1');
	regex(/\[\[(?:Vice[ -]|)President of the United States\|([^\]]{5,30})\]\]/gi, '$1');

//sociology, race & education
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/(?:\[\[H\.E\.?\]\])(?= ?\[\[|\n)/gi, 'His Excellency');
	regex(/(?:\[\[(Sri)\.?\]\]|Sri) (?=\[\[)/gi, '');
	regex(/\[\[(Dame|Mrs?|Rev|Lady|Sir|Sri)\.?\]\]/gi, '$1');
	regex(/\[\[(?:Malay styles and titles\||)(Dat(?:o'?|uk))\]\]/gi, '$1');
	regex(/\[\[(?:Doctor \(title\)\||)(Dr.?)\]\]/gi, '$1');
	regex(/\[\[(?:The Honou?rable\||)((?:The |)Hon.)\]\]/gi, '$1');
	regex(/\[\[(?:Knight Bachelor\||)(Sir)\]\]/gi, '$1');
	regex(/\[\[((?:assistant |visiting |university |)professors?)\]\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\[\[(?:(?:assistant |visiting |university |)professors?\||)(professor)\]\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\[\[(?:professor\||)((?:assistant |visiting |university |)professors?)\]\]/gi, '{{' + 'subst:' + 'lc:$1}}');
	regex(/\[\[((?:military |)academ(?:ic|ies|y)|class(?:room|)|campuse?|colleague|community|degree|(?:co-?|)education(?:al|)|household|lectur(?:e[rs]?|ing)|person|people|educators?|instructors?|intellectuals?|scholar(?:ships?|s?)|teach(?:ers?|ing)?|head(?:masters?|mistress| teachers?)|society|sociology|students?)\]\]/gi, '$1');
	regex(/\[\[(?:head teacher\||)(head(?: teacher| ?master| ?mistress))\]\]/gi, '$1');
	regex(/\[\[(academic)(?:ian|)\]\]/gi, '$1');
	regex(/\[\[(student(:s'?|) union)\]\]/gi, '$1');
	regex(/(?:\[\[)(freshman)(?:\]\]) year/gi, 'first year');
	regex(/(?:\[\[)(sophomore)(?:\]\]) year/gi, 'second year');
	regex(/\[\[(?:(?:discrimin|gradu)ation\||)((?:discrimin|gradu)at(e[ds]?|ion|ing))\]\]/gi, '$1');
	regex(/\[\[(?:philanthropy\||)(philanthrop(?:y|ic|ist))\]\]/gi, '$1');
	regex(/\[\[(?:eccentricity \(behaviou?r\)\||)(eccentric(?:ities|ity|s?))\]\]/gi, '$1');
	regex(/\[\[(?:theology\||)(theolog(?:y|ians?|ies))\]\]/gi, '$1');
	regex(/\[\[(?:(?:political |social |)activis[mt]\||)((?:political |social |)activis[mt])\]\]/gi, '$1');
	regex(/\[\[(educat(?:e[ds]?|ion|ional)|health[ -]?care)\]\]/gi, '$1');
	regex(/\[\[(boy|girl)\]\]/gi, '$1');
	regex(/\[\[(foster[ -]?|god[ -]?|grand[ -]?|step[ -]?|)(family|father|mother|parent|cousin|twin)\]\]/gi, '$1$2');
	regex(/\[\[(father|mother|parent|sister|brother|son|daughter|cousin)(s|)(-in-law)\]\]/gi, '$1$2$3');
	regex(/\[\[(?:child(?:ren|)\||)(baby|sons?|daughters?|child(?:ren|))\]\]/gi, '$1');
	regex(/\[\[(?:sibling\||)(sister|brother|sibling)\]\]/gi, '$1');
	regex(/\[\[(?:spouse\||)(husband|wife)\]\]/gi, '$1');
	regex(/\[\[(?:adolescence\||)(adolescen(?:ce|t)|teen(?:ager|s|))\]\]/gi, '$1');
	regex(/\[\[((?:great[ -]?|)(?:aunt|uncle|niece|nephew)(?:s|))\]\]/gi, '$1');
	regex(/\[\[(Latinos?)\]\]/g, '$1');
	regex(/\[\[((?:African|Asian|Chinese|Irish|Italian|Latino).Americans?)\]\]/g, '$1');
	regex(/\[\[((fashion|gay|pop)\sicons?)\]\]/gi, '$1');
	regex(/\[\[Native Americans in the United States\|(Native Americans?)\]\]/g, '$1');
	regex(/\[\[(Nobel Prize)\]\]/g, '$1');
	regex(/\[\[(a?political)\]\]/gi, '$1');
	regex(/\[\[professional(?:ism| [\w]*?|)\|(professional)\]\]/gi, '$1');
	regex(/\[\[(adventurer|celebrit(?:y|ies)|[bm]illionaires?|class|investor|(?:land|property)-?owner|poor|poverty(?: line|)|public figure|rich|socialites?)\]\]/gi, '$1');
	regex(/\[\[(?:conservation(?:ist|)\||)(conservation(ist|))\]\]/gi, '$1');
	regex(/\[\[(?:certification\||)(certif(ie[ds]|y))\]\]/gi, '$1');
	regex(/\[\[(public (?:housing|transport))\]\]/gi, '$1');
	regex(/\[\[(?:gossip|rumor|speculation\||)(gossip|rumou?r|speculation)\]\]/gi, '$1');
	regex(/\[\[(?:society\||)(societ(al|y|ies))\]\]/gi, '$1');
	regex(/\[\[(centrist|moderate|radical|extremist)\]\]/gi, '$1');
	regex(/\[\[(?:(?:cent[er]{2}[- ]|far[- ]|)(?:left|right)(?:[ -]wing|) politics\||)((?:cent[er]{2}[- ]|far[- ]|)(?:left|right)(?:[ -]wing|))\]\]/gi, '$1');
	regex(/\[\[(center|centre|extreme|far)([- ])(left|right)\]\]/gi, '$1$2$3');
	regex(/\[\[(?:centrism\||)(centre)\]\]/gi, '$1');
	regex(/\[\[(?:social class\||)(middle|social|upper|working)(.class|)\]\]/gi, '$1$2');
	regex(/\[\[(?:social class\||)(class)\]\]/gi, '$1');
	regex(/\[\[(?:social work\||)(social work(?:ers?|))\]\]/gi, '$1');
	regex(/\[\[(curriculum|discussion|examination|skill)\]\]/gi, '$1');
	regex(/\[\[(thes[ie]s)\]\]/gi, '$1');
	regex(/\[\[(certificate|under-?graduate|(?:Bachelor|Master) of (?:Arts|Sciences?)|Doctor of Philosophy|college|diplomas?|doctorates?|post-?graduate|(Bachelor|Master)['’]?s degree|honorary degree)\]\]/gi, '$1');
	regex(/\[\[((?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(\sschools?|\seducation))\]\]/gi, '$1');
	regex(/\[\[(?:(?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(?:\sschools?|\seducation)\|)((?:elementary|high(?:er|)|independent|nursery|primary|private|secondary|tertiary)(\sschools?|\seducation|))\]\]/gi, '$1');
	regex(/\[\[(?:university\||)(universit(?:ies|y))\]\]/gi, '$1');
	regex(/\[\[(B|M)\.?(A|S|Sc)\.?\]\]/gi, '$1$2');
	regex(/\[\[(?:Doctor of philosophy\||)Ph\.? ?D\.?\]\]/gi, 'PhD');
	regex(/\[\[(university|master\'?s|graduate|bachelor\'?s|post-?graduate|postgrad)(?:\sdegree)?\]\]/gi, '$1');
	regex(/\[\[Master of Business Administration\|(?:M\.B\.A\.|MBA)\]\]/g, 'MBA');
//	regex(/\[\[(?:(?:Bachelor|Doctor|Master)s? of (?:Arts|Sciences?))\|([A-Z]\.?[\w\.]{,3})\]\]/g, '$1');
//	regex(/\[\[(?:(?:Bachelor|Doctor|Master)s? of [A-Z]\w*)\|([A-Z])\.([A-Z]\w*)\.\]\]/g, '$1$2');
	regex(/\[\[(?:(?:honoris causa|honorary degrees?)\||)honorary (degrees?|doctorates?)\]\]/gi, 'honorary $1');
	regex(/\[\[(alma mater)\]\]/gi, '$1');
	regex(/\[\[(research(?:ers?|))\]\]/gi, '$1');
	regex(/\[\[(badge|cooperation|glory|grade|honorary|honou?r|medal|recognition|safety)(s|)\]\]/gi, '$1$2');

//	regex(/\[\[(?:Oxford University|Cambridge University)\|(Oxford|Cambridge)\]\]/g, '[[$1]]'); //retraining
	regex(/(\[\[[^\]]{1,26}\,\s(?:Cambridge|Oxford|London)\|(?:[^\]]{1,26} College)\]\])\,?\s\[\[(?:University\sof\s|)(Cambridge|Oxford|London)\]\]/g, '$1, $2');
	regex(/(\[\[[^\]]{1,26}\,\s(Cambridge|Oxford|London))\|(?:[^\]]{1,26} College)\]\]\,?\s\[\[(?:University\sof\s)(?:Cambridge|Oxford|London)(?:\|\2)\]\]/g, '$1]]');

//	regex(/\[\[(University of (?:Oxford|Cambridge))\|(?:Oxford University|Cambridge University)\]\]/g, '[[$1]]'); //retraining
	regex(/\[\[([^\]]{1,26})\,\s(Cambridge|Oxford|London)(\sUniversity|)\|([^\]]{1,26})\]\]\,?\s\[\[(Cambridge|Oxford|London)(\sUniversity|)(?:\|\2|)\]\]/g, '[[$1, $2]]');
	regex(/\[\[(?:Harvard|Harvard University|Yale|Yale University)\|((Harvard |Yale)|University of (?:Harvard |Yale))\]\]/g, '[[$1]]');

// lifestyle & religion
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(?:lifestyle \(sociology\)\||)(life[ -]?style)\]\]/gi, '$1');
	regex(/\[\[(?:popularity\||)(popular(?:ity|))\]\]/gi, '$1');
	regex(/\[\[(?:personal life\||)((?:everyday |personal )life)\]\]/gi, '$1');
	regex(/\[\[(beer|bread|brew(?:ery|ing|)|caf[eé]|cake|cheese|fast food|fat|modern|nutrition|restaura(?:nt|teur)|smoking|soft drinks?|wine)\]\]/gi, '$1');
	regex(/\[\[(?:moderni[sz]ation\||)(modern(?:i[sz]e[sdr]?|i[sz]ation))\]\]/gi, '$1');
	regex(/\[\[(?:bar \((?:counter|establishment)\)\||)(bars?)\]\]/gi, '$1');
	regex(/\[\[(?:catering\||)(cater(?:ers?|ing|s?))\]\]/gi, '$1');
	regex(/\[\[(?:champagne \(wine\)\||)(champagne)\]\]/gi, '$1');
	regex(/\[\[(?:addict(?:ion|)\||)(addict(?:ed|ion|ive|s|))\]\]/gi, '$1');
	regex(/\[\[(?:alcohol(?:ism|)\||)(alcohol(?:ic(?:| beverages?)|ism|))\]\]/gi, '$1');
	regex(/\[\[(?:tourism\||)(touris[mt]s?|tour guide)\]\]/gi, '$1');
	regex(/\[\[(?:religion\||)(religio(?:ns?|us))\]\]/gi, '$1');
	regex(/\[\[(anniversary|birthday|centennial|centenary|exercise|(?:film |music |)festival|gays?|god|(?:hetero|homo)sexual|jesus|Christ|Pope|multi-?cultural|racis[mt]|secular|sex|slang|travel)\]\]/gi, '$1');
	regex(/\[\[(?:lesbianism\||)(lesbian(?:ism|s|))\]\]/gi, '$1');
	regex(/\[\[(?:vegetarianism\||)(vegetarian(?:ism|s|))\]\]/gi, '$1');
	regex(/\[\[(?:celibacy\||)(celiba(?:cy|te|))\]\]/gi, '$1');
	regex(/\[\[(?:homosexuality\||)(homosexual(?:ity|s|))\]\]/gi, '$1');
	regex(/\[\[coming out\|(openly)\]\] (gay|lesbian)/gi, '$1$2');
	regex(/\[\[multiculturalism\|(multicultural)\]\]/gi, '$1');
	regex(/\[\[(?:homosexuality\||)(homosexual(?:ity|s|))\]\]/gi, '$1');
	regex(/\[\[(?:tradition\||)(tradition(?:s?|al))\]\]/gi, '$1');
	regex(/\[\[((?:popular |)culture)\]\]/gi, '$1');

	regex(/\[\[(?:Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi) Jews\|(Askenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\]/gi, '[[$1]]');
	regex(/\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\] \[\[(?:(?:jews|judaism)\||)(Jews?\]\])/gi, '[[$1$2');
	regex(/\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)\]\] \[\[(?:(?:jews|judaism)\||)(Jewish\]\])/gi, '[[$1 Jews|$1 $2');
	regex(/\[\[(Ashkenazi|Berber|Bukharan|Cochin|Mizrahi|Sephardi)(\]\])( Jews?)/gi, '[[$1$3$2');

//	regex(/\[\[(?:Shia|Sunni) Islam\|(Shia|Sunni)\]\]/gi, '[[$1]]');
	regex(/\[\[(?:(?:Shia|Sunni) Islam\||)(Shia|Sunni)\]\] \[\[(?:(?:islam(?:ism|)|m[ou]sl[ei]m])\||)(islam|m[ou]sl[ei]m]s?)(is[mt]|)\]\]/gi, '[[$1 $2]]$3');
	regex(/\[\[(Shia|Sunni)\]\] \[\[(?:(?:islam|m[ou]sl[ei]m])\||)((?:islam|m[ou]sl[ei]m])s?\]\])/gi, '[[$1 Islam|$1 $2');
	regex(/\[\[(Shia|Sunni)(\]\])( 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(/\[\[(Roman Catholic)\]\] (\[\[(?:Bishop|Cardinal) \(Catholicism\)\|)((?:Bishop|Cardinal(?:-Deacon|))\]\])/gi, '$2$1 $3');
	regex(/(\[\[(?:Bishop|Cardinal) \(Catholicism\)\|(?:Bishop|Cardinal(?:-Deacon|)))\]\]( (?:of|in) the )\[\[((?:Roman |)Catholic Church\]\])/gi, '$1$2$3');
	regex(/\[\[Priesthood \(Catholic Church\)\|(priesthood)\]\]/gi, '$1');
	regex(/\[\[Parish\|(pastoral)\]\]/gi, '$1');
    regex(/(?:\[\[Church of England\]\]|Church of England) \[\[(parish church)\]\]/gi, '[[Church of England $1]]');
    regex(/(?:\[\[(?:Anglicanism\||)Anglican\]\]|Anglican) \[\[(parish church)\]\]/gi, '[[Anglican $1]]');
    regex(/(\| ?architectural type ?= ?)(Church)\|/gi, '$1[[Church (building)|$2]]|');

	regex(/\[\[(?:(?:agnostic|athie)ism\||)((?:agnostic|athie)(?:ism|sts|s|))\]\]/gi, '$1');
	regex(/\[\[(bible|bishop|cardinal|chaplain|clergy|clergym[ae]n|pastor|prayer|preacher|priest)(s|)\]\]/gi, '$1$2');
	regex(/\[\[(?:christianity\||)(christians?|christianity|christian\sethic|christian\sfaith)\]\]/gi, '$1');
//	regex(/\[\[(?:(?:roman\s|)catholic(?:\schurch|ism|)\||)((?:roman\s|)catholic(?:\schurch|ism|s?))\]\]/gi, '$1'); //temporary disabling for work on church articles
	regex(/\[\[(?:protestant(?:ism|s|))\|(protestant(?:ism|s|))\]\]/gi, '[[$1]]');
	regex(/\[\[(?:muslim|islam)\|(moslems?|muslims?|islam(?:ic|))\]\]/gi, '[[$1]]');
	regex(/\[\[(?:(?:jews|judaism)\||)(jews?|jewish|judaism)\]\]/gi, '$1');
	regex(/\[\[(festival)\]\]/gi, '$1');

	regex(/\[\[((?:child|)birth|rape)\]\]/gi, '$1');
	regex(/\[\[(?:abortion\||)(abort(?:ed|ion|s))\]\]/gi, '$1');
	regex(/\[\[(?:pregnancy\||)(pregnan(?:cy|cies|t))\]\]/gi, '$1');
	regex(/\[\[(?:engagement\||)(engag(?:ed|ment))\]\]/gi, '$1');
	regex(/\[\[(?:(?:marriage|divorce)\||)(m\.|marriage|marry|marries|married|married\scouples?|wed|wedding|spouses?|divorc(?:e[eds]?|ing))\]\]/gi, '$1');
	regex(/\[\[(?:(?:married and |)maiden names?\||)((?:birth|maiden) names?|née?)\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:birth |)name(?: at birth|)\|)(née?)\]\]/gi, '$1'); 
	regex(/\[\[(honeymoon|marriage(?: licen[cs]e| certificate|))\]\]/gi, '$1');

	regex(/\{\{n[eé](e|)\}\}/gi, 'né$1'); //rem née template
//	regex(/\{\{n[eé](e|)\|([^\|\}]+)\}\}/gi, 'né$1 $2'); //rem née template with parameter

	regex(/\[\[(burial|cemetery|eulogy|funeral|ghost|graveyard|memorial)\]\]/gi, '$1');
	regex(/\[\[(graves?|tombs?)\]\]/g, '$1');

// biology, medical, crime
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(emergency|male|female|clinic|doctor|nurse|patient|physician|vandalism|violence|volunteer)\]\]/gi, '$1');
	regex(/\[\[(tablet|capsule|in[fj]ection|therapy|treatment)\]\]/gi, '$1');
	regex(/\[\[(ankle|arm|brain|chest|elbow|ear|eye|face|finger|foot|hand|hair|head|knee|leg|mouth|nail|nose|pupil|skin|throat|thumb|toe|waist|wrist)\]\]/gi, '$1');
	regex(/\[\[(?:human |)(ankle|arm|brain|chest|elbow|ear|eye|face|finger|foot|hand|hair|head|knee|leg|mouth|nail|nose|pupil|skin|throat|thumb|toe|waist|wrist)\|\1\]\]/gi, '$1');
	regex(/\[\[(blood)\]\]/gi, '$1');
	regex(/\[\[(bacteri(?:um|a)|disease|epidemic|fung(?:us|i)|health|viruse?)\]\]/gi, '$1');
	regex(/\[\[(?:medicine\||)(medic(?:al|ation|inal|ines?))\]\]/gi, '$1');
	regex(/\[\[(?:therapy\||)(therap(?:eutic|ies|y))\]\]/gi, '$1');
	regex(/\[\[(?:death\||)(dead|death|die[ds]?)\]\]/gi, '$1');
	regex(/\[\[(?:blindness\||)(blind(ed|ing|s|ness))\]\]/gi, '$1');
	regex(/\[\[(?:physician\||)(physicians?|doctors?)\]\]/gi, '$1');
	regex(/\[\[(?:surgery\||)(surgery|surgeons?)\]\]/gi, '$1');
	regex(/\[\[(cigarettes?|cigars?|smoking|tobacco)\]\]/gi, '$1');

	regex(/\[\[(beauty|happiness|(?:sad|shy)ness|adventure|loves?)\]\]/gi, '$1');
	regex(/\[\[(tattoos?)\]\]/gi, '$1');

	regex(/\[\[(?:crime\||)(crim(?:e|inal|inality)(|s))\]\]/gi, '$1');
	regex(/\[\[(?:acquittal\||)(acquit(?:ted|ting|tal|)(|s))\]\]/gi, '$1');
	regex(/\[\[(?:indictment\||)(indict(?:ed|ing|ment|)(|s))\]\]/gi, '$1');
	regex(/\[\[((?:hand|machine|shot|)[ -]?gun|rifle)\]\]/gi, '$1');
	regex(/\[\[(arson|burglar(?:y|ies)|bullet|drug trafficking|forger(?:y|ies)|(?:de|)fraud|fugitive|murder|riot|(?:bank |)robber(?:y|ies|)|security(?: guard|)|shooting|suspect|theft)\]\]/gi, '$1');
	regex(/\[\[(arrest|trial|[bj]ail|execution|firing squad|jury|parole)\]\]/gi, '$1');
	regex(/\[\[(?:Capital punishment\||)(Capital punishment|death(?: penalty|)|execut(?:ions?|ed?))\]\]/gi, '$1');
	regex(/\[\[(?:traffic\scollision\||)(automobile\saccident|car\saccident|car\scrash|(?:road\s|)traffic\saccident|traffic\scollision)\]\]/gi, '$1');
	regex(/\[\[(AIDS|HIV|bleed(?:ing|)|brain (damage|tumour)|(breast |lung |throat |)cancer|(?:clinical\s|)depression|coma|cough|(?:heart|kidney) failure|fever|fractures?|(?:drug |)overdose|gunshot wounds?|headache|ill|illness|injur(?:y|ies)|shock|stroke|suicide|surgery|vomit(?:ing|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:clinical\sdepression|depression\s\(mood\))\||)(clinical\sdepression|depression\s\(mood\)|depression|depressed)\]\]/gi, '$1');
	regex(/\[\[(?:myocardial infarction\||)(heart attack|cardiac arrest)\]\]/gi, '$1');
	regex(/\[\[(?:(?:police|police (?:force|officer|station))\||)(polic(?:e force|e(wo|)m[ae]n|e officers?|ing|e[ds]?|e station))\]\]/gi, '$1');
	regex(/\[\[(police |private |)(detectives?)\]\]/gi, '$1$2');
	regex(/\[\[(prisons?)\]\]/gi, '$1');

//music & media
//	regex(/\[\[(foobar)\]\]/gi, '$1');
    regex(/\[\[(?:mononym\||)mononym\]\]ously/gi, 'simply');
	regex(/\[\[((print |published |mass |broadcast |social |news |)media)\]\]/gi, '$1');
	regex(/\[\[(anthology|messages?|press conference)\]\]/gi, '$1');
	regex(/\[\[(?:media \(communication\)|print media|published media|mass media|broadcast media|news media|news media \(United States\))\|((mass.|)media)\]\]/gi, '$1');
	regex(/\[\[(porn|pornograph(y|ic))\]\]/gi, '$1');
    regex(/\[\[(?:pornography\||)(porn|pornograph(y|ic))\]\]/gi, 'simply');
	regex(/\[\[(?:nudity\||)(nude|nudity)\]\]/gi, '$1');
	regex(/\[\[(?:(?:child|film|movie|pornographic|stage|television|voice) act(?:ing|or)\||)((?:child|film|movie|porn(ographic|)|stage|television|tv|voice) (actors?|actress(es|)|artists?|stars?))\]\]/gi, '$1');
	regex(/\[\[play \(theatre\)\|(plays?|theatrical)\]\]/gi, '$1');
	regex(/\[\[(play) \(theatre\)\]\]/gi, '$1');
	regex(/\[\[(actor)\|actress\]\]/gi, '$1');
	regex(/\[\[act(?:ing|or)\|([^\[\]]*)\]\]/gi, '$1');
	regex(/\[\[leading (actor|actresse?|(?:title|lead|leading) role)\]\]/gi, '$1');
	regex(/\[\[(?:(?:title|lead|leading) actor\||)((?:title|lead|leading)( role|))\]\]/gi, '$1');
	regex(/\[\[(?:acting\||)(actor|acting|actresse?|thesbian)(s)?\]\]/gi, '$1$2');
	regex(/\[\[(?:spokesperson\||)(spokes(?:(?:wo|)m[ae]n|person|models?))\]\]/gi, '$1');
	regex(/\[\[(?:model\s\((?:art|fashion|person|people|profession)\)\||)((?:fashion[ -]|super[ -]?|)models?|modell?ing)\]\]/gi, '$1');
	regex(/\[\[dis[ck]\sjockey\|([^\]]{1,15})\]\]/gi, '$1');
	regex(/\[\[(?:radio broadcasting\||)(radio( broadcast|))\]\]/gi, '$1');
	regex(/\[\[(?:artist\||)(painter)\]\]/gi, '$1');
	regex(/\[\[(?:(?:performing|visual) arts\||)((?:perform(?:ances?|ing|e[dr]s?|s|)|visual)(?: art(?:ist|)s?|))\]\]/gi, '$1');
	regex(/\[\[(fine art)\]\]/gi, '$1');
	regex(/\[\[((?:action|biographical|horror) film)\]\]/gi, '$1');
	regex(/\[\[(?:(biographical film)\||)(?:biopic)\]\]/gi, 'biographical film');
	regex(/\[\[(?:(?:action|horror) (?:film|fiction)\||)(action|horror)\]\]/gi, '$1');

//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[spin-off \(media\)\|(spin[ -]?off)\]\]/gi, '$1');
	regex(/\[\[(animation|animated|film[ -]?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(/\[\[(?:entertainment(?: industry|)\||)(entertain(?:e[dr]s?|ment|s?)|show.?(?:biz|business))\]\]/gi, '$1');
	regex(/\[\[(?:(?:film|music|sex) industry\||)(film|music|sex)\]\]/gi, '$1');
	regex(/\[\[(([^\s:\|]*?)[\s-]documentary)\]\]/gi, '$1');
	regex(/\[\[(documentary\s([\w]*?))\]\]/gi, '$1');
	regex(/\[\[(([^\s:\|]*?)[\s-]documentary\s([\w]*?))\]\]/gi, '$1');
	regex(/\[\[(pilot( episode|))\]\]/gi, '$1');
	regex(/\[\[(?:Television pilot|Pilot \(television episode\))\|([^\]]+?)\]\]/gi, '$1');
	
	regex(/\[\[(news presenter)\|(?:newscaster)\]\]/gi, '$1'); 
	regex(/\[\[(?:media|news|radio|tv|television) (?:announcers?|hosts?|personality|presenters?|stations?)\|(media|radio |tv |television |)(announcers?|broadcaster|hosts?|newscasters?|personalit(ies|y)|presenters?|stations?)\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:celebrity|hosts?|personality|presenters?)\||)(media |radio |tv |television |)(announcer|broadcaster|hosts?|personalit(ies|y)|presenters?|stations?)\]\]/gi, '$1$2');
	regex(/(\[\[)(Drama\s[Pp]refecture\]\])/g, '$1:$2');
	regex(/\[\[(drama\s([\w]*?))\]\]/gi, '$1');

  // rem piped music & media
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(genre)\]\]/gi, '$1');
	regex(/\[\[animat(?:ion|ed|ed film|or)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:documentary|documentary film)\|([^\]]+?)\]\]/gi, '$1'); 
	regex(/\[\[(?:roman(?:ce|tic) film)\|(roman(?:ce|tic))\]\]/gi, '$1'); 
	regex(/\[\[(?:situation comedy\||)(sit[ -]?com|situation comedy)\]\]/gi, '$1');
	regex(/\[\[(?:soap opera\||)(soap(?: opera|))\]\]/gi, '$1');
	regex(/\[\[(?:documentary film|documentary \(film\)|documentary)\|([^\]]+?)\]\]/gi, '$1'); 
	regex(/\[\[(?:Serial \(radio and television\)|serial)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[((television|tv|web) (film|movie|pilot|program(me|)|(mini[ -]?|)series|show)(s|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:drama|dramatic programming)\||)(drama series|drama films?|tv drama|television drama)\]\]/gi, '$1');
	regex(/\[\[(?:(?:reality\s(?:television|show|tv))\||)(reality(?: show| tv| television|))\]\]/gi, '$1');
	regex(/\[\[(?:television\sprogram(?:me)?|tv program(?:me)?)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:talk|chat|talent|game|variety).show\||)((?:talk|chat|talent|game|variety)(.?show|)( host|))\]\]/gi, '$1');
	regex(/\[\[([^\W\s:\]]*?\s?)((?:television|tv) (?:series|films?|shows?|program(?:me|)s?|sitcom))\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:television|tv) (?:series|films?|shows?|program(?:me|)s?|sitcom))\|([^\]]+?)\]\]/gi, '$1');
    regex(/(?:\[\[(?:(?:Great Britain|United Kingdom)\||)British\]\]|British) \[\[(?:rock music\||)(rock(?: music)?)\]\]/gi, '[[British rock]]');
	regex(/\[\[(?:rhythm and blues\||)(rhythm and blues|R&B)\]\]/gi, '$1');
//	regex(/\[\[pop\smusic\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:singing|singer)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(soundtrack)(\salbum|)\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:demo|single|solo) \(music\)\||)(demo|single|solo)\]\]/gi, '$1');
	regex(/\[\[(boys? bands?|girl groups?)\]\]/gi, '$1');
	regex(/\[\[(black (?:&|and) white)\]\]/gi, '$1');

	regex(/\[\[(audio ?tape|cassette|DVD|video|music video|(?:compact\sdis[ck]|CD|C\.D\.)(?: single|))\]\]/gi, '$1');
	regex(/\[\[(?:LP record\||)((?:vinyl |)LP)\]\]/gi, '$1');
	regex(/\[\[compact\sdis[ck]\|(?:CD|C\.D\.)(s|)\]\]/gi, 'CD$1');
	regex(/\[\[(?:music download\||)((?:digital |)download)\]\]/gi, '$1');
	regex(/\[\[(CDROM)\]\]/gi, '$1');
	regex(/\[\[(?:albums?|album track|albums? \(music\)|record albums?)\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[((?:debut |music |record |self.titled debut |sophomore |studio |live |)albums?)\]\]/gi, '$1');
	regex(/\[\[((?:music|radio|recording|tv|television) (?:artist|studio))\]\]/gi, '$1');
	regex(/\[\[(?:(?:music|radio|recording|tv|television) (?:artist|studio))\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:performing |)(?:art(?:ist|)|music(?:ian|))\||)(artists?|musicians?|performers?)\]\]/gi, '$1');
	regex(/\[\[(?:record label\||)((?:record(?:ing|) |)labels?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:music |)composer\||)(?:music |)(composer)\]\]/gi, '$1');
	regex(/\[\[(?:(?:musician|educator)\||)(music teachers?)\]\]/gi, '$1');

	regex(/\[\[(Facebook|Google|Twitter|You\s?Tube)\]\]/gi, '$1');
	regex(/\[\[X \(social network\)\|(X)\]\]/gi, '$1');

	regex(/\[\[(singing|singer|vocal|vocalist|Pop\ssinger|Female\svocals|Songstress|Clean\svocals|Singer\s\(music\)|Pop\ssinger)\]\]/gi, '$1');
	regex(/\[\[(?:(?:backing |lead |)(?:sing(?:er|ing)|vocals|vocalist)\||)((?:backing|lead)(?: singer| vocal| vocalist|)(?:s|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:human |)voice|(?:playback |)singer|singing|vocals|vocalist)\||)((?:playback |)(?:singer|vocal|vocalist|voice)(?:s|))\]\]/gi, '$1');

	regex(/\[\[(classical |jazz |musical |pop |rock |)(band|ensemble|music|musician|group|standard|song)\]\]/gi, '$1$2');
	regex(/\[\[(?:(?:classical|dance|pop|rap|rock|jazz)(?:\smusic)|rock\s\(music\))\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:band\s\(music\)|group\s\(music\)|musical\sensemble|musical (?:band|group))\||)(musical\sensemble|group|bands?|rock\sbands?|Instrumental\sensemble|Rock\sgroups?|list\sof\smusical\sensembles|musical\sgroup|music\sband|music\sgroup|musical\sband|bar\sband|musical\sensembles?|music\sensemble|pop\sband)\]\]/gi, '$1');

	regex(/\[\[bass \(instrument?\)\|([^\]]+?)\]\]/gi, '$1');
	regex(/(\[\[)(acoustic |bass |blues |classical |electric |lead |rhythm )\((guitar)\s?\)(?=[\|\]])/gi, '$1$2$3');
	regex(/\[\[((?:acoustic |blues |classical |electric |lead |rhythm |)(?:guitar|guitarist)s?)\]\]/gi, '$1');
	regex(/\[\[(?:[^\]]+?) guitar\|((?:bass|electric|lead|rhythm)(?:\sguitar|))\]\]/gi, '$1');
	regex(/\[\[(?:bass\s|electric\s|lead\s|rhythm\s|)guitars?\|([^\]]+?)\]\]/gi, '$1');
	regex(/\[\[(bass|bassist|bass guitarists?|double\sbass|electric\sbass|metal\sbass|electric\sbass\sguitar|Alternate\sbass|bass\sguitars?|fretless\sbass\sguitar|base\sguitar)\]\]/gi, '$1');

	regex(/\[\[(?:(?:keyboard\sinstruments?|musical keyboards?)\||)((?:musical |)keyboard(?:\sinstrument|ist|)s?)\]\]/gi, '$1');
	regex(/\[\[(?:musician\||)((?:instrumentalist|recording artist)s?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:drum[ -]?kit|drummer)\||)(drums?|drum ?kits?|drumming|drummers?)\]\]/gi, '$1');
	regex(/\[\[(?:percussion\sinstrument\||)(percussion\sinstrument|percussion|percussionist)(|s)\]\]/gi, '$1$2');

	regex(/\[\[(bassoon|clarinet|harmonica|(?:French |)horn|oboe|trombone|tuba|viola)\]\]/gi, '$1');
	regex(/\[\[(?:(?:wood|)wind\sinstrument\||)(wood|)(wind\sinstruments?|wind)\]\]/gi, '$1$2');
	regex(/\[\[(?:violin\||)(violinists?|violins?)\]\]/gi, '$1');
	regex(/\[\[(?:saxophone\||)(saxophon(?:e|ist)s?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:violon|)cello\||)(cellists?|cellos?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:piano|pianist)\||)(pianos?|pianists?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:electr(?:on|)ic |)organ|organist)\||)((?:electr(?:on|)ic |)organ|organists?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:flute|flautist)\||)(flutes?|flautists?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:harp|harpist)\||)(harps?|harpists?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:electric |)organ|organist)\||)(organs?|organists?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:double bass|bass(?: guitar|))\||)(bass|bassists?)\]\]/gi, '$1');

// other musical instruments inside infoboxes
	regex(/(\|[ ]*?[Ii]nstrument[ ]*=[^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\](?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?=[ ]*?\|)/gi, '$1$2$3$4$5$6$7$8$9$10');
	regex(/(\|[ ]*?[Ii]nstrument[ ]*=[^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\](?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?:([^\[\|]*)\[\[(?:[^\|\]]+?\||)([^\]]+?)\]\]|)(?=[ ]*?\|)/gi, '$1$2$3$4$5$6$7$8$9$10'); //repeat

	regex(/\[\[(?:fashion\sdesign\||)(fashion|fashion\sdesign|fashion\sdesigners?|designers?)\]\]/gi, '$1');

	regex(/\[\[((?:se|pre)quels?)\]\]/gi, '$1');
	regex(/\[\[(box office|concerto?|opera|orchestra|repertoire)\]\]/gi, '$1');
	regex(/\[\[(?:film\||)(cinema|(?:feature |)films?|filming|movies?|big\sscreen|motion pictures?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:(?:music(?:al|)\s|)arranger|arrangement)\||)(music(?:al|)\sarranger|arranger)\]\]/gi, '$1'); //disabled unlinking of "arrangement"  24/10/2020
	regex(/\[\[((?:executive|film|stage|television|tv|theat(?:er|re|rical)|music|radio|record) (?:direc|distribu|edi|produc)(?:t?ing|tion|tor|er))\]\]/gi, '$1');
	regex(/\[\[(executive|film|music|production assistant|television|tv|theat(?:er|re|rical)|radio|record|(?: (?:direc|distribu|edi|produc))(?:t?ing|ted|ts?|tion|tors?|e[dr]?s?))\]\]/gi, '$1');
	regex(/\[\[(?:executive|film|stage|television|tv|theat(?:er|re|rical)|music|radio|record)\s(?:direc|distribu|edi|produc)(?:t?ing|tion|tor|er)\|((?:direc|distribu|edi|produc)(?:t?ing|ted|ts?|tion|tors?|e[dr]?s?))\]\]/gi, '$1');
	regex(/\[\[(?:music\sexecutive\||)(music\sexecutive|arranger)\]\]/gi, '$1');

// literary
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(book(?:shop|store)|(?:public |)library|map|news|pens?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:stand[ -]?up |)comedy\||)(?:stand[ -]?up |)(comedy|comedies|comic|comedians?|comediennes?|stand[ -]?up)\]\]/gi, '$1');
	regex(/\[\[(?:comic book\||)(comic(?: book|)s?)\]\]/gi, '$1');
	regex(/\[\[(?:poetry\||)(poe([mt]s?|tic|try))\]\]/gi, '$1');
	regex(/\[\[(?:best[- ]?seller\||)(best[- ]?sell(ers?|ing))\]\]/gi, '$1');
	regex(/\[\[hardcover\|(hard ?back|hard ?cover)\]\]/gi, '$1');
	regex(/\[\[((?:hard|paper)(?:back|cover))\]\]/gi, '$1');
	regex(/Print \(Hard(back|cover) (&|and) Paperback\)/gi, 'Print (hardback and paperback)');
	regex(/Print \(Hard(back|cover)\)/gi, 'Print (hard$1)');
	regex(/\[\[cover version\|(cover(?: version|))\]\]/gi, '$1');
	regex(/\[\[(?:(?:fiction(?:al character)?|Character \(arts\))\||)(fictional|(?:fictional |)character)\]\]/gi, '$1');
	regex(/\[\[non.?fiction\]\]/gi, 'non-fiction');
	regex(/\[\[(books?|diary|horror|humou?r(?:ist|)|(?:adult |children's |teen |)literature|(?:historical |)fiction|screenplay|magazine|(?:(?:auto.?)biograph|histor)ical novel|parody|(?:s|pr)equel|satir(?:e|ist)|short[- ]stor(?:ies|y)|suspense|thriller|trilogy)\]\]/gi, '$1');  
	regex(/\[\[(?:creative writing\||)((?:creative |)writ(?:er|ing))\]\]/gi, '$1');
	regex(/\[\[(?:(?:orator|public speak(?:er|ing))\||)((?:public |)speaker)\]\]/gi, '$1');
	regex(/\[\[(?:(?:author|writer)\||)(?:author|writer)\]\]/gi, 'author');
	regex(/\[\[(?:memoir(?:ist|)\||)(memoir(?:ist|s?))\]\]/gi, '$1');
	regex(/\[\[(?:espionage\||)(spy(?:ing|)|spies)\]\]/gi, '$1');
	regex(/\[\[(?:sabotage\||)(saboteur)\]\]/gi, '$1');
	regex(/\[\[(?:(?:interpret|translat)(?:ion|[eo]r)\||)((?:interpret|translat)(?:ion|ing|[eo]rs?))\]\]/gi, '$1');
	regex(/\[\[(?:essay\||)(essays?|essayists?)\]\]/gi, '$1');
	regex(/\[\[(?:encyclopa?edia\||)(encyclopa?edi[ac])\]\]/gi, '$1');
	regex(/\[\[(?:writers\||)(writer)\]\]/gi, '$1');
	regex(/\[\[(?:story[- ]?telling\||)(story[- ]?teller)\]\]/gi, '$1');
	regex(/\[\[(Wikipedia)\]\]/gi, '$1');
	regex(/\[\[(?:(?:novel|novella)\||)(novels?|novella|novell?ist)\]\]/gi, '$1');
	regex(/\[\[(?:(?:narrat(?:e|ion|or))\||)(narrat(?:e|ion|ive|or)s?)\]\]/gi, '$1');
	regex(/\[\[(?:plot \(narrative\)\||)(plots?)\]\]/gi, '$1');
	regex(/\[\[(manuscripts?|open letters?|picture books?)\]\]/gi, '$1');
	regex(/\[\[(?:(?:fantasy|romance|children's)(?: novel| literature)\||)(myth|fantasy|romance|children's)( books?| novel| literature|)\]\]/gi, '$1$2');

// sport
//	regex(/\[\[(foobar)\]\]/gi, '$1');
	regex(/\[\[(?:[^\|\]]+?\||)(association football|soccer)\]\]/gi, '$1');
	regex(/\[(football \(soccer\)|soccer)\|/gi, '[association football|');
	regex(/\[\[football (?:club|team)\|(club|team)\]\]/gi, '$1');
	regex(/\[\[pitch \(sports field\)\|(pitch)\]\]/gi, '$1');

	regex(/\[midfield(?:er|)\((?:(?:association |)football|soccer)\)\|/gi, '[midfielder');
	regex(/\[\[Association football\|(football)\]\] (\[\[Forward \(association football\)\|)((?:forward|striker)\]\])/gi, '$2$1 $3');
	regex(/\[\[(association football)\|(football)\]\] \[\[(striker)\]\]/gi, '[[Forward ($1)|$2 $3]]');
	regex(/\[\[Association football\|(football)\]\] (\[\[Goalkeeper \(association football\)\|)(goalkeeper\]\])/gi, '$2$1 $3');
	regex(/\[\[Association football\|(football)\]\] (\[\[Defender \(association football\)\|)(defender\]\])/gi, '$2$1 $3');
	regex(/\[\[(?:coach \(sports?\)\||)(coach|coache[ds]|coaching|manager)\]\]/gi, '$1');
	regex(/\[\[(?:cycling\||)(bicycle|cyclists?|cycling?)\]\]/gi, '$1');
	regex(/\[\[(athletics|badminton|(?:base|basket|(?:beach |)volley)ball|football(ers?|\splayers?|)|golf|gymnast(ics|)|hiking|hunting|judo|karate|martial arts|run(ning|ners?|)|sailing|softball|sports?|table tennis|track and field)\]\]/gi, '$1');
//	regex(/\[\[(?:track and field|athletics \(sport\))\|(track|field|athlet(?:ic|e)s?)\]\]/gi, '$1');
//	regex(/\[\[(?:Fencing \(sport\)\||)(fencing|fencer)\]\]/gi, '$1'); 
	regex(/\[\[(?:(?:human swimming|swimming \(sport\))\||)(swimming|swimmer|sw[aiu]ms?)\]\]/gi, '$1'); 
	regex(/\[\[(?:tennis\||)(tennis|tennis\scourts?|tennis players?)\]\]/gi, '$1');
	regex(/\[\[(grass courts?|clay courts?|hard courts?|grand\sslam)\]\]/gi, '$1');
	regex(/\[\[(Grand Slam)\]\]/gi, '$1');
//	regex(/\[\[(U\.?S\.?\sOpen|French Open|Australian Open)\]\]/gi, '$1'); //disabled 1 July 2021
    regex(/\[\[(?:(?:batsman|batting \(cricket\))\||)(?:Right[- ]Hand(ed|) Bat(?:sm[ae]n)?)\]\]/gi, 'Right-handed');
    regex(/\[\[(?:(?:batsman|batting \(cricket\))\||)(?:Left[- ]Hand(ed|) Bat(?:sm[ae]n)?)\]\]/gi, 'Left-handed');
    regex(/\[\[(?:batsman|batting \(cricket\))\|([\w ]*)\]\]/gi, '$1');
    regex(/(\[\[)Leg[- ][Bb]reak\|/g, '$1leg break|');
    regex(/(\[\[)Off[- ][Ss]pin\|/g, '$1off spin|');
    regex(/(\[\[)Off[- ][Bb]reak\|/g, '$1off break|');
    regex(/(\[\[(?:Fast bowling|leg break|off spin|leg spin|off break|spin bowling)\|)((?:slow |)(?:right|left))[- ]arm[- ]([-\w ]*\]\])/gi, '$2-arm $1$3');
    regex(/(\[\[)Fast[- ][Bb]owling\|Fast[- ][Mm]edium/g, '$1fast bowling|fast–medium');
    regex(/(\[\[)Fast[- ][Bb]owling\|Fast/g, '$1fast bowling|fast');
    regex(/(\[\[)Fast[- ][Bb]owling\|Medium[- ]Fast/g, '$1fast bowling|medium-fast');
    regex(/(\[\[)Fast[- ][Bb]owling\|Medium/g, '$1fast bowling|medium');
    regex(/(\[\[)Spin[- ][Bb]owling\|Spin/g, '$1spin bowling|spin');
//full dates
	regex(/\[\[(1\d{3}|20\d{2})(?:\]\]-\[\[|-)([0-1]\d-[0-3]\d)\]\]/gi, '$1-$2');
	regex(/([12]\d{3})-\[\[([0-1]\d-(?:[0-2]\d|30|31))\]\]/gi, '$1-$2');
//	regex(/\[\[(1\d?{2-3}|20\d{2})\]\]/gi, '$1');

	regex(/\[\[([0-2]?\d|30|31)(?:th|st|nd|rd|)[\s_](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(/\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)) ([0-2]?\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[\s\w]+)\|)([^\}]*)(\}\})/gi, protect_function);	
	regex(/(\{\{s-(?:aft|bef|ttl)\|)([^\}]*)(\}\})/gi, protect_function);	
}


function ohc_unprotect_refs()
{

	//unprotect all dates
	regex(/⍌([0-9]+)⍍/g, function(x, n) {
		var res = linkmap[n];
		res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
			var res = linkmap[n];
			res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
				var res = linkmap[n];
				res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
					return linkmap[n];
				});
				return res;
			});
			return res;
		});
		return res;
	});
}

/** ------------------------------------------------------------------------ **/

function Unlink_second() {
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2$4$2$5$2$6$2'); //remove duplicated links 
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2$4$2$5$2'); //remove duplicated links (second pass)
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2$4$2$5$2'); //remove duplicated links (second pass)
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2$4$2'); //remove duplicated links (third pass)
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2$4$2'); //remove duplicated links (third pass)
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/gi, '$1$2$3$2'); //remove duplicated links (third pass)
	regex(/(\[\[([^:\[\]|]+)\]\][\S\s]+\[\[\2\]\][\S\s]{0,10000})\[\[\2\]\]([\S\s]{0,10000})\[\[\2\]\]/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 [[WP:Linking]]', 'append');
	doaction('diff');
}

function addLinks() {
     var add = mw.util.addPortletLink;
  $( 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);
}
 
 
if( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ){
	$.when(
		$.ready,
		mw.loader.using( 'mediawiki.util' ),
		/*************
		*** Regex menu framework
		*** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Regex_menu_framework>
		***    - adds a sidebar menu of user-defined scripts.
		*************/
		$.ajax(
			'//meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript',
			{ dataType:'script', cache:true }
		)
	)
	.then( addLinks );
}
// </syntaxhighlight>