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