Jump to content

User:Ohconfucius/script/flagcruft.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.
// <nowiki>

function ohc_flagcruft(){
 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(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ABW|ARU|Aruba)|ABW|ARU)(?:\|[^{}]+|)\}\}/g, 'Aruba');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AFG|Afghanistan)|AFG)(?:\|[^{}]+|)\}\}/g, 'Afghanistan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AGO|ANG|Angola)|AGO|ANG)(?:\|[^{}]+|)\}\}/g, 'Angola');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AHO|Netherlands Antilles)|AHO)(?:\|[^{}]+|)\}\}/g, 'Netherlands Antilles');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AIA|Anguilla)|AIA)(?:\|[^{}]+|)\}\}/g, 'Anguilla');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ALA|Åland Islands)|ALA)(?:\|[^{}]+|)\}\}/g, 'Åland Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ALB|Albania)|ALB)(?:\|[^{}]+|)\}\}/g, 'Albania');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AND|Andorra)|AND)(?:\|[^{}]+|)\}\}/g, 'Andorra');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ANT|Antigua and Barbuda)|ANT)(?:\|[^{}]+|)\}\}/g, 'Antigua and Barbuda');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ARE|UAE|United Arab Emirates)|ARE|UAE)(?:\|[^{}]+|)\}\}/g, 'United Arab Emirates');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ARG|Argentina)|ARG)(?:\|[^{}]+|)\}\}/g, 'Argentina');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ARM|Armenia)|ARM)(?:\|[^{}]+|)\}\}/g, 'Armenia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ASM|SAM|ASA|American Samoa)|ASM|SAM|ASA)(?:\|[^{}]+|)\}\}/g, 'American Samoa');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ATA|Antarctica)|ATA)(?:\|[^{}]+|)\}\}/g, 'Antarctica');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ATF|French Southern Territories)|ATF)(?:\|[^{}]+|)\}\}/g, 'French Southern Territories');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ATG|Antigua and Barbuda)|ATG)(?:\|[^{}]+|)\}\}/g, 'Antigua and Barbuda');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AUS|Australia)|AUS)(?:\|[^{}]+|)\}\}/g, 'Australia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AUT|Austria)|AUT)(?:\|[^{}]+|)\}\}/g, 'Austria');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(AZE|Azerbaijan)|AZE)(?:\|[^{}]+|)\}\}/g, 'Azerbaijan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BDI|Burundi)|BDI)(?:\|[^{}]+|)\}\}/g, 'Burundi');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BEL|Belgium)|BEL)(?:\|[^{}]+|)\}\}/g, 'Belgium');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BEN|Benin)|BEN)(?:\|[^{}]+|)\}\}/g, 'Benin');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BES|Bonaire, Sint Eustatius and Saba)|BES)(?:\|[^{}]+|)\}\}/g, 'Bonaire, Sint Eustatius and Saba');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BFA|BUR|Burkina Faso)|BFA|BUR)(?:\|[^{}]+|)\}\}/g, 'Burkina Faso');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BGD|BAN|Bangladesh)|BGD|BAN)(?:\|[^{}]+|)\}\}/g, 'Bangladesh');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BGR|BUL|Bulgaria)|BGR|BUL)(?:\|[^{}]+|)\}\}/g, 'Bulgaria');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BHN|BHR|Bahrain)|BHN|BHR)(?:\|[^{}]+|)\}\}/g, 'Bahrain');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BHS|BAH|Bahamas)|BHS|BAH)(?:\|[^{}]+|)\}\}/g, 'Bahamas');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BIH|Bosnia and Herzegovina)|BIH)(?:\|[^{}]+|)\}\}/g, 'Bosnia and Herzegovina');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BLM|Saint Barthélemy)|BLM)(?:\|[^{}]+|)\}\}/g, 'Saint Barthélemy');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BLR|Belarus)|BLR)(?:\|[^{}]+|)\}\}/g, 'Belarus');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BLZ|BIZ|Belize)|BLZ|BIZ)(?:\|[^{}]+|)\}\}/g, 'Belize');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BMU|BER|Bermuda)|BMU|BER)(?:\|[^{}]+|)\}\}/g, 'Bermuda');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BOL|Bolivia)|BOL)(?:\|[^{}]+|)\}\}/g, 'Bolivia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BRA|Brazil)|BRA)(?:\|[^{}]+|)\}\}/g, 'Brazil');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BRB|BAR|Barbados)|BRB|BAR)(?:\|[^{}]+|)\}\}/g, 'Barbados');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BRN|BRU|Brunei)|BRN|BRU)(?:\|[^{}]+|)\}\}/g, 'Brunei');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BTN|BHU|Bhutan)|BTN|BHU)(?:\|[^{}]+|)\}\}/g, 'Bhutan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BVT|Bouvet Island)|BVT)(?:\|[^{}]+|)\}\}/g, 'Bouvet Island');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BWA|BOT|Botswana)|BWA|BOT)(?:\|[^{}]+|)\}\}/g, 'Botswana');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(BIR|Burma)|BIR)(?:\|[^{}]+|)\}\}/g, 'Burma');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CAF|Central African Republic)|CAF)(?:\|[^{}]+|)\}\}/g, 'Central African Republic');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CAN|Canada)|CAN)(?:\|[^{}]+|)\}\}/g, 'Canada');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CCK|Cocos (Keeling) Islands)|CCK)(?:\|[^{}]+|)\}\}/g, 'Cocos (Keeling) Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CHE|S[UW]I|Switzerland)|CHE|S[UW]I)(?:\|[^{}]+|)\}\}/g, 'Switzerland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CHL|CHI|Chile)|CHL|CHI)(?:\|[^{}]+|)\}\}/g, 'Chile');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CHN|PRC|(?:People\'s Republic of |)China)|CHN|PRC)(?:\|[^{}]+|)\}\}/g, 'China');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CIV|Côte d'Ivoire)|CIV)(?:\|[^{}]+|)\}\}/g, 'Côte d\'Ivoire');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CMR|Cameroon)|CMR)(?:\|[^{}]+|)\}\}/g, 'Cameroon');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(COD|Democratic Republic of the Congo)|COD)(?:\|[^{}]+|)\}\}/g, 'Democratic Republic of the Congo');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(COG|CGO|Republic of the Congo|Congo, Republic of the)|COG|CGO)(?:\|[^{}]+|)\}\}/g, 'Republic of the Congo');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(COK|Cook Islands)|COK)(?:\|[^{}]+|)\}\}/g, 'Cook Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(COL|Colombia)|COL)(?:\|[^{}]+|)\}\}/g, 'Colombia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(COM|Comoros)|COM)(?:\|[^{}]+|)\}\}/g, 'Comoros');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CPV|Cape Verde)|CPV)(?:\|[^{}]+|)\}\}/g, 'Cape Verde');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CRI|CRC|Costa Rica)|CRI|CRC)(?:\|[^{}]+|)\}\}/g, 'Costa Rica');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CUB|Cuba)|CUB)(?:\|[^{}]+|)\}\}/g, 'Cuba');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CU[RW]|Curaçao)|CU[RW])(?:\|[^{}]+|)\}\}/g, 'Curaçao');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CXR|Christmas Island)|CXR)(?:\|[^{}]+|)\}\}/g, 'Christmas Island');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CYM|CAY|Cayman Islands)|CYM|CAY)(?:\|[^{}]+|)\}\}/g, 'Cayman Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CYP|Cyprus)|CYP)(?:\|[^{}]+|)\}\}/g, 'Cyprus');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CS[AK]|Czechoslovakia)|CS[AK])(?:\|[^{}]+|)\}\}/g, 'Czechoslovakia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(CZE|Czech Republic)|CZE)(?:\|[^{}]+|)\}\}/g, 'Czech Republic');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DDR|East Germany)|DDR)(?:\|[^{}]+|)\}\}/g, 'East Germany');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DEU|GER|(?:Nazi |)Germany)|DEU|GER)(?:\|[^{}]+|)\}\}/g, 'Germany');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DJI|Djibouti)|DJI)(?:\|[^{}]+|)\}\}/g, 'Djibouti');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DMA|Dominica)|DMA)(?:\|[^{}]+|)\}\}/g, 'Dominica');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DNK|DEN|Denmark)|DNK|DEN)(?:\|[^{}]+|)\}\}/g, 'Denmark');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DOM|Dominican Republic)|DOM)(?:\|[^{}]+|)\}\}/g, 'Dominican Republic');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(DZA|ALG|Algeria)|DZA|ALG)(?:\|[^{}]+|)\}\}/g, 'Algeria');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ECU|Ecuador)|ECU)(?:\|[^{}]+|)\}\}/g, 'Ecuador');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(EGY|Egypt)|EGY)(?:\|[^{}]+|)\}\}/g, 'Egypt');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ENG|England)|ENG)(?:\|[^{}]+|)\}\}/g, 'England');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ERI|Eritrea)|ERI)(?:\|[^{}]+|)\}\}/g, 'Eritrea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ESH|Western Sahara)|ESH)(?:\|[^{}]+|)\}\}/g, 'Western Sahara');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ESP|SP[AN]|Spain)|ESP|SP[AN])(?:\|[^{}]+|)\}\}/g, 'Spain');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(EST|Estonia)|EST)(?:\|[^{}]+|)\}\}/g, 'Estonia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ETH|Ethiopia)|ETH)(?:\|[^{}]+|)\}\}/g, 'Ethiopia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FIN|Finland)|FIN)(?:\|[^{}]+|)\}\}/g, 'Finland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FJI|FIJ|Fiji)|FJI|FIJ)(?:\|[^{}]+|)\}\}/g, 'Fiji');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FLK|Falkland Islands)|FLK)(?:\|[^{}]+|)\}\}/g, 'Falkland Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FRA|France)|FRA)(?:\|[^{}]+|)\}\}/g, 'France');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FRG|West Germany)|FRG)(?:\|[^{}]+|)\}\}/g, 'West Germany');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FRO|Faroe Islands)|FRO)(?:\|[^{}]+|)\}\}/g, 'Faroe Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(FSM|(?:Federated States of |)Micronesia)|FSM)(?:\|[^{}]+|)\}\}/g, 'Federated States of Micronesia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GAB|Gabon)|GAB)(?:\|[^{}]+|)\}\}/g, 'Gabon');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GBR|GRB|UK(?:GBI|)|United Kingdom)|GBR|GRB|UK(?:GBI|))(?:\|[^{}]+|)\}\}/g, 'United Kingdom');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GBR2|Great Britain)|GBR2)(?:\|[^{}]+|)\}\}/g, 'Great Britain');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GDR|East Germany)|GDR)(?:\|[^{}]+|)\}\}/g, 'East Germany');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GEO|Georgia)|GEO)(?:\|[^{}]+|)\}\}/g, 'Georgia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GGY|Guernsey)|GGY)(?:\|[^{}]+|)\}\}/g, 'Guernsey');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GHA|Ghana)|GHA)(?:\|[^{}]+|)\}\}/g, 'Ghana');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GIB|Gibraltar)|GIB)(?:\|[^{}]+|)\}\}/g, 'Gibraltar');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GIN|GUI|Guinea)|GIN|GUI)(?:\|[^{}]+|)\}\}/g, 'Guinea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GLP|Guadeloupe)|GLP)(?:\|[^{}]+|)\}\}/g, 'Guadeloupe');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GMB|GAM|(?:The |)Gambia)|GMB|GAM)(?:\|[^{}]+|)\}\}/g, 'Gambia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GNB|GBS|Guinea-Bissau)|GNB|GBS)(?:\|[^{}]+|)\}\}/g, 'Guinea-Bissau');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GNQ|GEQ|Equatorial Guinea)|GNQ|GEQ)(?:\|[^{}]+|)\}\}/g, 'Equatorial Guinea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GRC|GRE|Greece)|GRC|GRE)(?:\|[^{}]+|)\}\}/g, 'Greece');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GRD|GRN|Grenada)|GRD|GRN)(?:\|[^{}]+|)\}\}/g, 'Grenada');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GRL|Greenland)|GRL)(?:\|[^{}]+|)\}\}/g, 'Greenland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GTM|GUA|Guatemala)|GTM|GUA)(?:\|[^{}]+|)\}\}/g, 'Guatemala');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GUF|French Guiana)|GUF)(?:\|[^{}]+|)\}\}/g, 'French Guiana');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GUM|Guam)|GUM)(?:\|[^{}]+|)\}\}/g, 'Guam');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(GUY|Guyana)|GUY)(?:\|[^{}]+|)\}\}/g, 'Guyana');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HKG|Hong Kong)|HKG)(?:\|[^{}]+|)\}\}/g, 'Hong Kong');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HMD|Heard Island and McDonald Islands)|HMD)(?:\|[^{}]+|)\}\}/g, 'Heard Island and McDonald Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HND|HON|Honduras)|HND|HON)(?:\|[^{}]+|)\}\}/g, 'Honduras');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HRV|CRO|Croatia)|HRV|CRO)(?:\|[^{}]+|)\}\}/g, 'Croatia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HTI|HAI|Haiti)|HTI|HAI)(?:\|[^{}]+|)\}\}/g, 'Haiti');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(HUN|Hungary)|HUN)(?:\|[^{}]+|)\}\}/g, 'Hungary');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IDN|INA|Indonesia)|IDN|INA)(?:\|[^{}]+|)\}\}/g, 'Indonesia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IMN|IOM|Isle of Man)|IMN|IOM)(?:\|[^{}]+|)\}\}/g, 'Isle of Man');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IND|India)|IND)(?:\|[^{}]+|)\}\}/g, 'India');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IOT|British Indian Ocean Territory)|IOT)(?:\|[^{}]+|)\}\}/g, 'British Indian Ocean Territory');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IRL|Ireland)|IRL)(?:\|[^{}]+|)\}\}/g, 'Ireland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IRN|IRI|Iran)|IRN|IRI)(?:\|[^{}]+|)\}\}/g, 'Iran');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(IRQ|Iraq)|IRQ)(?:\|[^{}]+|)\}\}/g, 'Iraq');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ISL|Iceland)|ISL)(?:\|[^{}]+|)\}\}/g, 'Iceland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ISR|Israel)|ISR)(?:\|[^{}]+|)\}\}/g, 'Israel');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ITA|Italy)|ITA)(?:\|[^{}]+|)\}\}/g, 'Italy');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(JAM|Jamaica)|JAM)(?:\|[^{}]+|)\}\}/g, 'Jamaica');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(JEY|Jersey)|JEY)(?:\|[^{}]+|)\}\}/g, 'Jersey');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(JOR|Jordan)|JOR)(?:\|[^{}]+|)\}\}/g, 'Jordan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(JPN|JAP|Japan)|JPN|JAP)(?:\|[^{}]+|)\}\}/g, 'Japan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KAZ|Kazakhstan)|KAZ)(?:\|[^{}]+|)\}\}/g, 'Kazakhstan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KEN|Kenya)|KEN)(?:\|[^{}]+|)\}\}/g, 'Kenya');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KGZ|Kyrgyzstan)|KGZ)(?:\|[^{}]+|)\}\}/g, 'Kyrgyzstan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KHM|CAM|Cambodia)|KHM|CAM)(?:\|[^{}]+|)\}\}/g, 'Cambodia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KIR|Kiribati)|KIR)(?:\|[^{}]+|)\}\}/g, 'Kiribati');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KNA|SKN|Saint Kitts and Nevis)|KNA|SKN)(?:\|[^{}]+|)\}\}/g, 'Saint Kitts and Nevis');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(?:KOR|ROK|(South |Republic of )Korea)|KOR|ROK)(?:\|[^{}]+|)\}\}/g, '$1Korea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(KWT|KUW|Kuwait)|KWT|KUW)(?:\|[^{}]+|)\}\}/g, 'Kuwait');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LAO|Laos)|LAO)(?:\|[^{}]+|)\}\}/g, 'Laos');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LBN|LIB|Lebanon)|LBN|LIB)(?:\|[^{}]+|)\}\}/g, 'Lebanon');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LBR|Liberia)|LBR)(?:\|[^{}]+|)\}\}/g, 'Liberia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LBY|LBA|Libya)|LBY|LBA)(?:\|[^{}]+|)\}\}/g, 'Libya');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LCA|Saint Lucia)|LCA)(?:\|[^{}]+|)\}\}/g, 'Saint Lucia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LIE|Liechtenstein)|LIE)(?:\|[^{}]+|)\}\}/g, 'Liechtenstein');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LKA|SRI|Sri Lanka)|LKA|SRI)(?:\|[^{}]+|)\}\}/g, 'Sri Lanka');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LSO|LES|Lesotho)|LSO|LES)(?:\|[^{}]+|)\}\}/g, 'Lesotho');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LIT|LTU|Lithuania)|LIT|LTU)(?:\|[^{}]+|)\}\}/g, 'Lithuania');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LUX|Luxembourg)|LUX)(?:\|[^{}]+|)\}\}/g, 'Luxembourg');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(LVA|LAT|Latvia)|LVA|LAT)(?:\|[^{}]+|)\}\}/g, 'Latvia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MAC|Macao)|MAC)(?:\|[^{}]+|)\}\}/g, 'Macao');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MAF|Saint Martin)|MAF)(?:\|[^{}]+|)\}\}/g, 'Saint Martin');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MAR|Morocco)|MAR)(?:\|[^{}]+|)\}\}/g, 'Morocco');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MCO|MON|Monaco)|MCO|MON)(?:\|[^{}]+|)\}\}/g, 'Monaco');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MDA|MLD|Moldova)|MDA|MLD)(?:\|[^{}]+|)\}\}/g, 'Republic of Moldova');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MDG|MAD|Madagascar)|MDG|MAD)(?:\|[^{}]+|)\}\}/g, 'Madagascar');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MDV|Maldives)|MDV)(?:\|[^{}]+|)\}\}/g, 'Maldives');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MEX|M[ée]xico)|MEX)(?:\|[^{}]+|)\}\}/g, 'Mexico');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MHL|Marshall Islands)|MHL)(?:\|[^{}]+|)\}\}/g, 'Marshall Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MKD|Macedonia)|MKD)(?:\|[^{}]+|)\}\}/g, 'Macedonia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MLI|Mali)|MLI)(?:\|[^{}]+|)\}\}/g, 'Mali');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MLT|Malta)|MLT)(?:\|[^{}]+|)\}\}/g, 'Malta');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MMR|MYA|Myanmar)|MMR|MYA)(?:\|[^{}]+|)\}\}/g, 'Myanmar');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MNE|Montenegro)|MNE)(?:\|[^{}]+|)\}\}/g, 'Montenegro');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MNG|MGL|Mongolia)|MNG|MGL)(?:\|[^{}]+|)\}\}/g, 'Mongolia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MNP|NMI|Northern Mariana Islands)|MNP|NMI)(?:\|[^{}]+|)\}\}/g, 'Northern Mariana Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MOZ|Mozambique)|MOZ)(?:\|[^{}]+|)\}\}/g, 'Mozambique');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MRT|MTN|Mauritania)|MRT|MTN)(?:\|[^{}]+|)\}\}/g, 'Mauritania');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MSR|Montserrat)|MSR)(?:\|[^{}]+|)\}\}/g, 'Montserrat');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MTQ|Martinique)|MTQ)(?:\|[^{}]+|)\}\}/g, 'Martinique');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MUS|MRI|Mauritius)|MUS|MRI)(?:\|[^{}]+|)\}\}/g, 'Mauritius');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MWI|MAW|Malawi)|MWI|MAW)(?:\|[^{}]+|)\}\}/g, 'Malawi');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MYS|MAS|Malaysia)|MYS|MAS)(?:\|[^{}]+|)\}\}/g, 'Malaysia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(MYT|Mayotte)|MYT)(?:\|[^{}]+|)\}\}/g, 'Mayotte');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NAM|Namibia)|NAM)(?:\|[^{}]+|)\}\}/g, 'Namibia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NCL|New Caledonia)|NCL)(?:\|[^{}]+|)\}\}/g, 'New Caledonia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NER|NIG|Niger)|NER|NIG)(?:\|[^{}]+|)\}\}/g, 'Niger');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NFK|Norfolk Island)|NFK)(?:\|[^{}]+|)\}\}/g, 'Norfolk Island');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NIR|Northern Ireland)|NIR)(?:\|[^{}]+|)\}\}/g, 'Northern Ireland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NGA|NGR|Nigeria)|NGA|NGR)(?:\|[^{}]+|)\}\}/g, 'Nigeria');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NIC|NCA|Nicaragua)|NIC|NCA)(?:\|[^{}]+|)\}\}/g, 'Nicaragua');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NIU|Niue)|NIU)(?:\|[^{}]+|)\}\}/g, 'Niue');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NLD|NED|(The |)Netherlands)|NLD|NED)(?:\|[^{}]+|)\}\}/g, 'Netherlands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NOR|Norway)|NOR)(?:\|[^{}]+|)\}\}/g, 'Norway');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NPL|NEP|Nepal)|NPL|NEP)(?:\|[^{}]+|)\}\}/g, 'Nepal');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NRU|Nauru)|NRU)(?:\|[^{}]+|)\}\}/g, 'Nauru');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(NZL?|New Zealand)|NZL?)(?:\|[^{}]+|)\}\}/g, 'New Zealand');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(OMN|OMA|Oman)|OMN|OMA)(?:\|[^{}]+|)\}\}/g, 'Oman');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PAK|Pakistan)|PAK)(?:\|[^{}]+|)\}\}/g, 'Pakistan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PAN|Panama)|PAN)(?:\|[^{}]+|)\}\}/g, 'Panama');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PCN|Pitcairn Islands)|PCN)(?:\|[^{}]+|)\}\}/g, 'Pitcairn Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PER|Peru)|PER)(?:\|[^{}]+|)\}\}/g, 'Peru');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PHL|PHI|Philippines)|PHL|PHI)(?:\|[^{}]+|)\}\}/g, 'Philippines');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PLW|Palau)|PLW)(?:\|[^{}]+|)\}\}/g, 'Palau');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PNG|Papua New Guinea)|PNG)(?:\|[^{}]+|)\}\}/g, 'Papua New Guinea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(POL|Poland)|POL)(?:\|[^{}]+|)\}\}/g, 'Poland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PRI|PUR|Puerto Rico)|PRI|PUR)(?:\|[^{}]+|)\}\}/g, 'Puerto Rico');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PRK|North Korea)|PRK)(?:\|[^{}]+|)\}\}/g, 'North Korea');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PRT|POR|Portugal)|PRT|POR)(?:\|[^{}]+|)\}\}/g, 'Portugal');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PRY|PAR|Paraguay)|PRY|PAR)(?:\|[^{}]+|)\}\}/g, 'Paraguay');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PSE|PLE|Palestinian Territory)|PSE|PLE)(?:\|[^{}]+|)\}\}/g, 'Palestinian Territory');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(PYF|French Polynesia)|PYF)(?:\|[^{}]+|)\}\}/g, 'French Polynesia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(QAT|Qatar)|QAT)(?:\|[^{}]+|)\}\}/g, 'Qatar');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(REU|Réunion)|REU)(?:\|[^{}]+|)\}\}/g, 'Réunion');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ROC|TPE|Republic of China)|ROC|TPE)(?:\|[^{}]+|)\}\}/g, 'Taiwan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ROU|ROM|Romania)|ROU|ROM)(?:\|[^{}]+|)\}\}/g, 'Romania');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(RUS|Russia)|RUS)(?:\|[^{}]+|)\}\}/g, 'Russia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(RWA|Rwanda)|RWA)(?:\|[^{}]+|)\}\}/g, 'Rwanda');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SAU|KSA|Saudi Arabia)|SAU|KSA)(?:\|[^{}]+|)\}\}/g, 'Saudi Arabia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SDN|SUD|Sudan)|SDN|SUD)(?:\|[^{}]+|)\}\}/g, 'Sudan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SCO|Scotland)|SCO)(?:\|[^{}]+|)\}\}/g, 'Scotland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SCG|Serbia and Montenegro)|SCG)(?:\|[^{}]+|)\}\}/g, 'Serbia and Montenegro');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SEN|Senegal)|SEN)(?:\|[^{}]+|)\}\}/g, 'Senegal');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SGP|SIN|Singapore)|SGP|SIN)(?:\|[^{}]+|)\}\}/g, 'Singapore');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SGS|South Georgia and the South Sandwich Islands)|SGS)(?:\|[^{}]+|)\}\}/g, 'South Georgia and the South Sandwich Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SHN|Saint Helena, Ascension and Tristan da Cunha)|SHN)(?:\|[^{}]+|)\}\}/g, 'Saint Helena, Ascension and Tristan da Cunha');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SJM|Svalbard and Jan Mayen)|SJM)(?:\|[^{}]+|)\}\}/g, 'Svalbard and Jan Mayen');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SLB|SOL|Solomon Islands)|SLB|SOL)(?:\|[^{}]+|)\}\}/g, 'Solomon Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SLE|Sierra Leone)|SLE)(?:\|[^{}]+|)\}\}/g, 'Sierra Leone');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SLV|ESA|El Salvador)|SLV|ESA)(?:\|[^{}]+|)\}\}/g, 'El Salvador');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SMR|San Marino)|SMR)(?:\|[^{}]+|)\}\}/g, 'San Marino');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SOM|Somalia)|SOM)(?:\|[^{}]+|)\}\}/g, 'Somalia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SPM|Saint Pierre and Miquelon)|SPM)(?:\|[^{}]+|)\}\}/g, 'Saint Pierre and Miquelon');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SRB|Serbia)|SRB)(?:\|[^{}]+|)\}\}/g, 'Serbia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SSD|South Sudan)|SSD)(?:\|[^{}]+|)\}\}/g, 'South Sudan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(STP|S[aã]o Tom[eé] and Príncipe)|STP)(?:\|[^{}]+|)\}\}/g, 'Sao Tome and Principe');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SUR|Suriname)|SUR)(?:\|[^{}]+|)\}\}/g, 'Suriname');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SVK|Slovakia)|SVK)(?:\|[^{}]+|)\}\}/g, 'Slovakia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SVN|SLO|Slovenia)|SVN|SLO)(?:\|[^{}]+|)\}\}/g, 'Slovenia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SWE|Sweden)|SWE)(?:\|[^{}]+|)\}\}/g, 'Sweden');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SWZ|Swaziland)|SWZ)(?:\|[^{}]+|)\}\}/g, 'Swaziland');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SXM|Sint Maarten)|SXM)(?:\|[^{}]+|)\}\}/g, 'Sint Maarten');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SYC|SEY|Seychelles)|SYC|SEY)(?:\|[^{}]+|)\}\}/g, 'Seychelles');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(SYR|(Syrian Arab Republic|Syria))|SYR)(?:\|[^{}]+|)\}\}/g, 'Syria');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TCA|Turks and Caicos Islands)|TCA)(?:\|[^{}]+|)\}\}/g, 'Turks and Caicos Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TCH|Czechoslovakia)|TCH)(?:\|[^{}]+|)\}\}/g, 'Czechoslovakia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TCD|CHA|Chad)|TCD|CHA)(?:\|[^{}]+|)\}\}/g, 'Chad');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TGO|TOG|Togo)|TGO|TOG)(?:\|[^{}]+|)\}\}/g, 'Togo');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(THA|Thailand)|THA)(?:\|[^{}]+|)\}\}/g, 'Thailand');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TJK|Tajikistan)|TJK)(?:\|[^{}]+|)\}\}/g, 'Tajikistan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TKL|Tokelau)|TKL)(?:\|[^{}]+|)\}\}/g, 'Tokelau');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TKM|Turkmenistan)|TKM)(?:\|[^{}]+|)\}\}/g, 'Turkmenistan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TLS|East Timor|Timor.Leste)|TLS)(?:\|[^{}]+|)\}\}/g, 'East Timor');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TON|TGA|Tonga)|TON|TGA)(?:\|[^{}]+|)\}\}/g, 'Tonga');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TTO|TRI|Trinidad and Tobago)|TTO|TRI)(?:\|[^{}]+|)\}\}/g, 'Trinidad and Tobago');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TUN|Tunisia)|TUN)(?:\|[^{}]+|)\}\}/g, 'Tunisia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TUR|Turkey)|TUR)(?:\|[^{}]+|)\}\}/g, 'Turkey');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TUV|Tuvalu)|TUV)(?:\|[^{}]+|)\}\}/g, 'Tuvalu');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TWN|Taiwan)|TWN)(?:\|[^{}]+|)\}\}/g, 'Taiwan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(TZA|TAN|Tanzania)|TZA|TAN)(?:\|[^{}]+|)\}\}/g, 'Tanzania');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(UGA|Uganda)|UGA)(?:\|[^{}]+|)\}\}/g, 'Uganda');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(UKR|Ukraine)|UKR)(?:\|[^{}]+|)\}\}/g, 'Ukraine');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(UMI|United States Minor Outlying Islands)|UMI)(?:\|[^{}]+|)\}\}/g, 'United States Minor Outlying Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(URY|URU|Uruguay)|URY|URU)(?:\|[^{}]+|)\}\}/g, 'Uruguay');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(URS|Soviet Union|USSR)|URS)(?:\|[^{}]+|)\}\}/g, 'Soviet Union');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(USA?|United States(?: of America|))|USA?|U\.S\.)(?:\|[^{}]+|)\}\}/g, 'United States');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(UZB|Uzbekistan)|UZB)(?:\|[^{}]+|)\}\}/g, 'Uzbekistan');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VAT|Vatican City)|VAT)(?:\|[^{}]+|)\}\}/g, 'Vatican City');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VCT|VIN|Saint Vincent and the Grenadines)|VCT|VIN)(?:\|[^{}]+|)\}\}/g, 'Saint Vincent and the Grenadines');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VEN|Venezuela)|VEN)(?:\|[^{}]+|)\}\}/g, 'Venezuela');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VGB|IVB|British Virgin Islands)|VGB|IVB)(?:\|[^{}]+|)\}\}/g, 'British Virgin Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VIR|ISV|United States Virgin Islands)|VIR|ISV)(?:\|[^{}]+|)\}\}/g, 'United States Virgin Islands');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VNM|VIE|Viet ?[Nn]am)|VNM|VIE)(?:\|[^{}]+|)\}\}/g, 'Vietnam');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(VUT|VAN|Vanuatu)|VUT|VAN)(?:\|[^{}]+|)\}\}/g, 'Vanuatu');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(WAL|Wales)|WAL)(?:\|[^{}]+|)\}\}/g, 'Wales');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(WLF|Wallis and Futuna)|WLF)(?:\|[^{}]+|)\}\}/g, 'Wallis and Futuna');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(WSM|Samoa)|WSM)(?:\|[^{}]+|)\}\}/g, 'Samoa');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(YEM|Yemen)|YEM)(?:\|[^{}]+|)\}\}/g, 'Yemen');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*((?:FR-|)YUG|Yugoslavia)|(?:FR-|)YUG)(?:\|[^{}]+|)\}\}/g, 'Yugoslavia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ZAF|RSA|South Africa)|ZAF|RSA)(?:\|[^{}]+|)\}\}/g, 'South Africa');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ZAI|Zaire)|ZAI)(?:\|[^{}]+|)\}\}/g, 'Zaire');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ZMB|ZAM|Zambia)|ZMB|ZAM)(?:\|[^{}]+|)\}\}/g, 'Zambia');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(ZWE|ZIM|Zimbabwe)|ZWE|ZIM)(?:\|[^{}]+|)\}\}/g, 'Zimbabwe');

	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(EU|European Union)|EU)(?:\|[^{}]+|)\}\}/g, 'European Union');
	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(UNO|United Nations)|UNO)(?:\|[^{}]+|)\}\}/g, 'United Nations');

//	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*(?:[^|]*\|)\s*name=([^{}]*))\}\}/gi, '$1');
//	regex(/\{\{(?:[Ff]lag(?:country|u?)\|[ ]*([^{}]*))\}\}/gi, '$1');
	
//country templates that deliver a linked mini flag icon
	regex(/\{\{(Austria|Chile|China|Algeria|Iraq|Italy|Japan|New Zealand|Philippines|Tunisia)\}\}/g, '$1'); 

//from parameter within football templates
	regex(/(\|\s?(?:club|)nat\s?=\s?)[^|}]+(?=[\|}])/gi, '$1');

//strip bare icons
	regex(/\{\{\s*flag ?icon\s*(?:image|)\|(?:[^{}]+|)\}\}[ ]*/gi, '');
    regex(/\[\[(File|image):(Flag of |Bandera)[^|\]]+\.svg(?:\|[^\]]+)?\|\d{2,3}px(?:\|[^\]]+)?\]\][ ]?/gi, ''); 
	regex(/\[\[\s*Image:Med \d\.png\s*\|\d\d?\s*px\s*\]\][ ]*/gi, '');

//strip bare facilities icons
    regex(/\[\[(File|image):Feature (parking|suburban buses)\.svg(?:\|[^\]]+)?\|\d\d?px(?:\|[^\]]+)?\]\][ ]?/gi, ''); 
 
} 


function Ohc_flag_to_country(){
	//Add a tag to the summary box
	regex(/(\|[ ]*)(\{\{\s*[Ff]lag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*(\{\{\s*[Ff]lag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*(\[\[[-–'é\w ]+\|)((?:1\d\d|20[0-2])\d\]\])/gi, '$1$4$2/$3 $5'); // curing Easter egg
	regex(/(\{\{\s*[Ff]lag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*((?:\'\'\'?|)\[\[[-–'é\w ]+\|)((?:1\d\d|20[0-2])\d\]\])/gi, '$2$1 $3'); // curing Easter egg
    regex(/\{\{[Ff]lag\s?icon\s?\|/gi, '{{flag|');
	ohc_flagcruft();
	setreason('[[WP:WORDPRECEDENT|Words as the primary means of communication]]/[[WP:EGG]]', 'appendonce');
}
 
function Ohc_flagicon_to_flagathlete(){
	//Add a tag to the summary box
//	regex(/(\|[ ]*)(\{\{\s*[Ff]lag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*(\{\{\s*flag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*(\[\[[-–'é\w ]+\|)((?:1\d\d|20[0-2])\d\]\])/gi, '$1$4$2/$3 $5'); // curing Easter egg
//	regex(/(\{\{\s*[Ff]lag(?:icon|)\|(?:[^{}]+|)\}\})[ ]*((?:\'\'\'?|)\[\[[-–'é\w ]+\|)((?:1\d\d|20[0-2])\d\]\])/gi, '$2$1 $3'); // curing Easter egg
    regex(/{{[Ff]lagicon\|([^}]+)}} ?\'{0,3}(\[\[(?:[^\]]+)\]\])\'{0,3}/gi, '{{flagathlete|$2|$1}}'); //using template with country identifier (per request 27/07/2019)
//  regex(/\{\{[Ff]lag\s?icon\s?\|/gi, '{{flagathlete|');
//	ohc_flagcruft();
	setreason('More appropriate flag', 'appendonce');
}
function ohc_flagcruft_driver(){
	//Add a tag to the summary box
	ohc_flagcruft();
	setreason('[[MOS:INFOBOXFLAG|avoid flags in infoboxes]]', 'appendonce');
}
 
$.when(mw.loader.using('mediawiki.util'), $.ready).done(function () {
 if(document.forms.editform) {
  mw.util.addPortletLink('p-tb', 'javascript:ohc_flagcruft_driver()', 'FLAGCRUFT', 'cruft', 'cruft', '', '');
//  mw.util.addPortletLink('p-tb', 'javascript:ohc_flagwimbledon1()', 'FLAGWIMBLEDON', 'use template with country identifier', 'cruft', '', '');
//  mw.util.addPortletLink('p-tb', 'javascript:ohc_flagwimbledon2()', 'FLAGWIMBLEDON', 'use template with country identifier', 'cruft', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_flag_to_country()', 'FLAG->COUNTRY', 'cruft', 'cruft', '', '');
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_flagicon_to_flagathlete()', 'FLAGICON->FLAGATHLETE', 'cruft', 'cruft', '', '');

  }
});
// </nowiki>