Jump to content

User:Walking the blues/test.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.
// Feedback and constructive criticism are welcome...  
// As I am a scripting newbie, any technical advice on the 'hows and the wherefores' are especially welcome.

//Please exercise due care should you decide to use it.

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

// Compound links
	txt.value=txt.value.replace(/(\[\[UNESCO)\]\] \[\[(World Heritage Site\]\])/g, '$1 $2');

	txt.value=txt.value.replace(/\[\[List of (?:football clubs in Germany|German football clubs)(\|German football (?:club|team))\]\]/gi, '[[football in Germany|German association football club]]');

//	txt.value=txt.value.replace(/\[\[(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)\]\]/gi, '$1');	// unlinks German states - not for general use 
// unlinks Italian states
	txt.value=txt.value.replace(/\[\[(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)\]\]/gi, '$1');

	txt.value=txt.value.replace(/(?:\[\[|)(Australia|Austria|Brazil|Korea|India|New\sZealand|Russia|South\sAfrica|South\sKorea)(?:\]\]|)(n|ian|) (amateur |professional |)\[\[(?:football \(soccer\)|soccer|Association football)(?:\|football|)\]\] (club|\[\[(?:List of football clubs in (?:Australia|Austria|Brazil|Korea|India|New\sZealand|Russia|South\sAfrica|South\sKorea)|:Category:(Australia|Austria|Brazil|Korea|India|New\sZealand|Russia|South\sAfrica|South\sKorea)(n|ian|) football clubs)\|(?:club|team)\]\])/gi, '$3[[Football in $1|$1$2 association football]] club'); 

	txt.value=txt.value.replace(/\[\[(Argentina|Australia|Austria|Belgium|Brazil|British\sIsles|Canada|the Netherlands|Korea|People's\sRepublic\sof\sChina|the Philippines|Czech\sRepublic|Denmark|Finland|England|France|Germany|Spain|Greece|Hungary|India|Ireland|Italy|Mexico|Holland|New\sZealand|Norway|Poland|Portugal|Russia|Scotland|South\sAfrica|South\sKorea|Sweden|Switzerland|Wales)\|(Argentinian|Australian|Austrian|Belgian|Belgium|Brazilian|British|Canadian|Dutch|Korean|Chinese|(?:Ph|F)ilipp?in[eo]|Czech|Danish|Finnish|English|French|German|Spanish|Greek|Hungarian|Indian|Irish|Italian|Mexican|Middle\sEastern|(:the\s|)Netherlands|Holland|New\sZealand|Norwegian|Polish|Portuguese|Russian|Scandinavian|Scottish|South\sAfrican|South\sKorean|Swedish|Swiss|Welsh)\]\] (professional |)\[\[(football \(soccer\)|soccer|Association football)(?:\|football|)\]\] (club|\[\[(?:List of football clubs in (?:Argentina|Australia|Austria|Belgium|Brazil|British\sIsles|Canada|the Netherlands|Korea|People's\sRepublic\sof\sChina|the Philippines|Czech\sRepublic|Denmark|Finland|England|France|Germany|Spain|Greece|Hungary|India|Ireland|Italy|Mexico|Holland|New\sZealand|Norway|Poland|Portugal|Russia|Scotland|South\sAfrica|South\sKorea|Sweden|Switzerland|Wales)|:Category:(?:Argentinian|Australian|Austrian|Belgian|Belgium|Brazilian|British|Canadian|Dutch|Korean|Chinese|(?:Ph|F)ilipp?in[eo]|Czech|Danish|Finnish|English|French|German|Spanish|Greek|Hungarian|Indian|Irish|Italian|Mexican|Middle\sEastern|(:the\s|)Netherlands|Holland|New\sZealand|Norwegian|Polish|Portuguese|Russian|Scandinavian|Scottish|South\sAfrican|South\sKorean|Swedish|Swiss|Welsh) football clubs)\|(?:club|team)\]\])/gi, '$3[[Football in $1|$2 association football]] club');

// US States piped
	txt.value=txt.value.replace(/(\[\[([^\]]{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|(Georgia \(U.S. state\)\|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 \(U.S. state\)\|Washington)|West Virginia|Wisconsin|Wyoming)\]\]/gi, '$1$3');
 
//Canada
	txt.value=txt.value.replace(/\[\[([^\]]{1,20})\,\s(AB|Alta\.?|B\.?C\.?|Man\.?|MB|N\.?B\.?|N\.?S\.?|Nfld\.?, Lab\.?|NL|ON|Ont\.?|P\.?E\.?I\.?|PE|QC|Que\.?, P\.?Q\.?|Sask\.?|SK|Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\|([^\]]{1,20})\]\]\,?\s\[\[(Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan)\]\]/gi, '[[$1, $2]]');

	txt.value=txt.value.replace(/\[\[(Beijing|Berlin|Paris|Hong\sKong|London|Melbourne|Mexico\sCity|Moscow|New\sDelhi|Rome|Shanghai|Sydney|Tokyo)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(Chicago|Detroit|Los\sAngeles|Miami|New\sYork\sCity|San\sFrancisco|Washington\,?\sD\.?C\.?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(California|Florida|Hawai.?i|New\sYork|Texas)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(Paris, France)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(London, England)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:Los Angeles|San\sDiego|San\sFrancisco), (?:California|CA))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:(?:Los Angeles|San\sDiego|San\sFrancisco)(?:,\sCalifornia|,\sCA|))\|([^\]]{1,30})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:New York City)\|([^\]]{3,30})\]\]/gi, '$1');
//	txt.value=txt.value.replace(/(\[\[Vancouver)\]\], \[\[(British Columbia\]\])/gi, '$1, $2');
	txt.value=txt.value.replace(/\[\[Sydney(?:\,\sNew South Wales|\,\sAustralia|)\|([^\]]{1,30})\]\]/gi, '$1');

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

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

// Country and language; city
	txt.value=txt.value.replace(/\[\[(area|cit(?:y center|y centre|ies|y)|countr(?:y|ies)|count(?:y|ies)|district|parish|province|region|rural|suburb|town(?:ship|)|urban(?: area|)|village)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:rural|urban)(?: area|i[sz]ation|)\|((?:rural|urban)(i[sz]ed?|i[sz]ation|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[List of (?:countries|U.S. states)\|(country|states?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:US|U\.S\.) states?\|(state)\]\]/gi, '$1');

	//top 7
	txt.value=txt.value.replace(/\[\[(British|(?:People's Republic of |)China|Chinese|England|English|France|French|Germany?|Great\sBritain|Japan|Japanese|Spain|Spanish|United\sKingdom|U\.K\.|UK|United\sStates(\sof\sAmerica|)|US|U\.S\.|USA|U\.S\.A\.)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:(?:People's Republic of |)China|England|France|Germany|Great\sBritain|Japan|Spain|United\sKingdom|U\.K\.|UK|United\sStates(?:\sof\sAmerica|)|US|U\.S\.|USA|U\.S\.A\.)\|(British|Chinese|English|French|German|Japanese|Spanish|American|US)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:United\sStates(?:\sof\sAmerica|))\|(US|U\.S\.|USA|U\.S\.A\.)\]\]/gi, 'US');
	txt.value=txt.value.replace(/\[\[(?:United\sKingdom(?:\sof\sGreat Britain and Northern Ireland|))\|(U\.K\.|UK)\]\]/gi, 'UK');
	
	txt.value=txt.value.replace(/\[\[(?:Chinese|English|French|German|British|Japanese|Spanish|United\sKingdom|U\.K\.|UK|American)\s\(?(?:language|people)\)?\|([^\]]*)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:Chinese|English|French|German|British|Japanese|Spanish|American)\slanguage)\]\]/gi, '$1');		//unpiped

//time and seasons
	txt.value=txt.value.replace(/\[\[Present\s\(time\)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(da[iy]|month|night|season(?:al|)|hour|minute|present|second|morning|afternoon|midnight|noon|week|year|decade|century)([ -]?end|ly|s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[((Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)days?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day)\|(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)(\.|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(spring|summer|winter|autumn|fall)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[spring\s\(season\)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[autumn\|(fall)\]\]/gi, '$1');
// months
	txt.value=txt.value.replace(/\[\[(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');
	txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|([^\]]{1,30})\]\]/gi, '$1');

// simple words and numbers	
	txt.value=txt.value.replace(/\[\[(\d{1,3}(,\d{3})*)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[([a-oq-z]\w[s\.]?)\]\]/g, '$1');

// proper nouns
	txt.value=txt.value.replace(/\[\[(public holiday)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[Christmas\|([^\]]+?)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(Christmas|Easter|Labour|May)( day| eve|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(New year('s day|'s eve|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:Broadway|West End)(\sTheatre|)|Hollywood|Hollywood, California)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:Broadway|West End) theatre\|(Broadway|West End)\]\]/g, '$1'); 

// people general, professions
	txt.value=txt.value.replace(/\[\[(activis[mt]|arranger|art(?:ist|)|athlete|athletics|author|(?:auto|)biography|camera|cinema|civil\sserv(?:ant|ice)|comedian|composer|conducting|conductor|consul(?:ate|ar|tant|)|criminal|critic|cultur(?:e|al)|dance[rs]?|dancing|dentist|designer|dj|dis[ck] jockey|drawing|drummer|editor|editors?-in-chief|educator|embassy|fishing|group|guest star|hacker|journalis[mt]|librar(?:ian|ie|y)|mayor|model|music(?:al(?: theatre|theater|)|ian|)|multi-instrumentalist|offic(?:e|er|ial)|paint(?:er|ing|)|piano|pianist|photograph(?:er|y|)|playwright|police|politic(?:s|al|ian)|porn star|producer|professor|professional|prostitut(?:e|ion)|pseudonym|publisher|radio|(?:record )company|sailor|scien(?:ce|tist)|screen[ -]?writer|sculpt(?:or|ure)|soldier|solicitor|singer.songwriter|song|songwriter|songwriting|toy|tradition|trumpet|trumpeter|waiter|writ(?:er|ing))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(baker|grocer)(ies|y|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(cable |satellite |terrestrial |)(tv|television)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(clothing|clothe?|cotton|leather|silk|nylon|dress|tailor|(?:neck|)tie|shirt|jacket|trouser|shoe|suit)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(captain|major|general|lieutenant|private(?: \(rank\)|))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[musical theatre\|(music(?:al(?: theatre|theater|)s?))\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(beauty (?:competition|contest|pageant|queen))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(game|contest|contestant|question|answer)(s|)\]\]/gi, '$1$2');

	txt.value=txt.value.replace(/\[\[(?:paint|writ)ing\|(painter|writer)\]\]/gi, '$1'); 

//business & legal
	txt.value=txt.value.replace(/\[\[(attorney|business(?:m[ae]n|person|e?)|CEO|chief executive officer|chair(?:m[ae]n|person)|director|entrepreneur|executive|judge|law|lawyer|legal|president|tax|taxation)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[businessperson\|(businessm[ae]n)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[((?:private(?:ly held|) |public |listed |quoted |)(?:company|corporation))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:private(?:ly held|) |public |listed |quoted )company)\|(private|public|listed|quoted)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(chair \(official\)|chairman)\|(chair[^\]]*?)\]\]/gi, 'Chairman');
	txt.value=txt.value.replace(/\[\[chief (?:executive|financial|operating) officer\|(C[EFO]O|C\.[EFO]\.O\.|chief executive)\]\]/gi, '$1'); 

// buildings structure and environment	
	txt.value=txt.value.replace(/\[\[(bath|bathroom|ceiling|fixture|fitting|kitchen|shower|toilet|wall)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(airport|architect(?:ure|)|churche?|fa[cç]ade|furniture|garden(?:ing|)|hospital|home|hotel|hous(?:e|ing)|museum|neighbou?rhood|park|roof|shop(?:ping mall|ping arcade|)|stadium|skyscraper|interior design(?:er|))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[church \(building\)\|(church)(es|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(brick|building|composite|cement|concrete|environment|foundation|glass|steel|structure|wood)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(dam|port|bridge|metro( station|)|reservoir|road|street|traffic|tunnel|underground|(?:high|free|motor)way)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(central business district|down[ -]?town)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[central business district\|(CBD)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:bus|metro|railway|tube|underground)(?: stop| station)\|(station)\]\]/gi, '$1');
//	txt.value=txt.value.replace(/\[\[(foobar)(s|)\]\]/gi, '$1$2');

// earth science nouns
	txt.value=txt.value.replace(/\[\[(animal|insect|plant)(s|)\]\](?![ai])/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(fruit|meat|timber|livestock|milk|dairy(?: produce)|vegetables?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(fish|sheep|(?:hu|wo|)m[ae]n)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(bird|bull|cat|chicken|dog|cow|pig|horse|pet|lion|tiger|elephant|giraffe)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(beach|cave|earthquake|forest|hill|island|lagoon|land|lake|mountain|ocean|pond|river|sea|stream|tree)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(automobile|bicycle|boat|car|ferry|engine|motor(?:cycle)|ship|truck|tyre|van|wheel)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(equipment|instrument|machine|tool)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(breakfast|lunch|dinner|supper|food|beverage|biscuit|dessert|tea|chocolate|coffee|juice|apple|banana|carrot|lemon|pear|potatoe?|tomatoe?|onion|pork|beef|poultry)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(solid|liquid|gase?)(s|)\]\]/gi, '$1$2');

	txt.value=txt.value.replace(/\[\[(name|number|word|letter|sentence)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(metal|min(?:ing|e|eral)|chrom(?:ium|e)|gold|iron|iron ore|nickel|alumin(?:a|i?um)|copper|diamond|mineral sands|coal|lead||oil|natural gas|silver)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(blog|(?:e-?|)mail|computer|personal\scomputer|PC|laptop|laptop\scomputer|(?:cell|cellular|mobile|portable|tele) ?phone|MP3(?: player|)|SMS|digital audio player|(?:computer |)(?:application|hardware|program|software|technology)|(?:computer |video |)game)(s|)\]\]/gi, '$1$2');

// economy
	txt.value=txt.value.replace(/\[\[(bank(?:er|ing|s|)|capital|cargo|contracts?|(?:un|)employ(?:e[der]s?|ment)|finance|GDP|gross domestic product|inflation|insurance|investors?|joint ventures?|money|per capita(?: income|))\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[gross domestic product\|(GDP)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(alcohol|assault|club|colou?r|(?:television |tv |)commercial|confectionery|cosmetic|crime|down[ -]?town|electricity|fire|flower|gas(?:oline|)|heating|histor(?:ical|ian|y)|institute|Internet|inventor|job|magazine|mosque|(?:news|)paper|publicity||organi[sz](?:e|ation)|party|petrol|plastic|(?:air |)pollution|product|salary|school|smog|subsidiary|supermarket|synthesi[sz]er|synagog(?:ue|)|television|television network|temple|textile|theater|theatre|time(?:line|)|touris[mt]|wage|water|website)(s|)\]\]/gi, '$1$2'); 
	txt.value=txt.value.replace(/\[\[(advertis(?:ing|ement)|brand|consumer|logo|market(?:ing|)|sign(?:age|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(agriculture|horticulture|meat|beef|pork|cereal|corn|lettuce|wheat|maize|rice|sugar|tobacco)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[orange \((?:colou?r|fruit)\)\|(oranges?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:tele|)communic(?:ation|ate))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(airline|transport(?:ation|)|train|tram|)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(trad(e|ing)|shipping|railway|railroad)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[rail transport\|(rail|railways?|railroad)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[retailing\|(retail(?:er|ing|)|(?:retail |)shop)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[economics\|(economics?|economists?|economical)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[statistics\|(statistics?|statisticians?|statistical)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[((economi|statisti)(cs?|cians?|sts?|cal))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(profit(?:able|ability|s|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((im|ex)(port(?:er|)s?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(factor(?:y|ies)|manufactur(?:er?|ing))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(coal min(e[rs]?|ing))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(farm(er|s|ing|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[farming\|(farm(er|s|ing|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[history\|(histor(?:ical|ian|ies|y))\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(NGO|non-?(?:governmental|profit)(\sorgani[sz]ations?|))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(charitable\sorgani[sz]ations?|charit(?:ies|y))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[non-?profit\sorgani[sz]ation\|(non-?profit\sorgani[sz]ations?|non-profit)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[non-?(?:governmental|profit)\sorgani[sz]ation\|(non-?(?:governmental|profit)\sorgani[sz]ation|NGO)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:charity \(practice\)|charitable\sorgani[sz]ation)\|(charitable\sorgani[sz]ations?|charit(?:able|ies|y))\]\]/gi, '$1');
// weather and climate
	txt.value=txt.value.replace(/\[\[(cloud|ecolog(?:ical|ists?|y)|rain(?:fall|)|snow|storm|weather)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[ecology\|(ecologists?|ecological)\]\]/gi, '$1');

// measurements and perception
	txt.value=txt.value.replace(/\[\[(add|addition|average|difference|mean|sum|total)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(acre|foot|feet|hectare|inch(?:es|)|in.|yard|(?:kilo|)(?:lit|met)(?:er|re)s?|(?:kilo|)gram|mile|pound)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(square.)(feet|inches|(kilo|)met(er|re)s)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:centi|kilo|milli|)met(?:er|re)(?:s|)\|([ckm]?m)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(?:centi|deci|hecto|milli|)lit(?:er|re)(?:s|)\|([cdHm]?l)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(stereo|mono)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[[Ss]tereophonic sound\|[Ss](tereo)\]\]/g, 'stereo');
	txt.value=txt.value.replace(/\[\[monaural\|(mono)\]\]/gi, '$1');

// colours
//	txt.value=txt.value.replace(/\[\[(royal.|navy.)(blue)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(light.|dark.|)(beige|black|brown|blue|crimson|gr[ae]y|green|maroon|orange|pink|purple|red|violet|white|yellow)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(royal.|navy.)(blue)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[[^\(\[\]]* \(colou?r\)\|([^\]]*)\]\]/gi, '$1');

// geo-politics
	txt.value=txt.value.replace(/\[\[(emperor|empress|empire|imperial|monarchy?|king(?:dom|)|queen|prince(?:ess|)|(?:prime |)minister|members? of parliament|MP|general secretary|secretary(?: of state|)|govern(?:or|ment))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:monarchy?|sovereign)\|(king(?:dom|)|queen)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[member of parliament\|(MP)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[Western world\|((?:The |)West(?:ern|erner|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:cabinet|minister) \(government\)\|(cabinet|minister)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:Illegal drug trade|drug traffic(?:king|))\|([^\]]*)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[capital (?:city|\(political\))\|(capital)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(north|south|east|west|left|rights?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(air.force|appeal|assassinat(?:ion|ed?)|bribe(?:ry|)|census|constitution|corruption|coup(?: d['’][ée]tat|)|crop|currenc(?:y|ie)|defection|dollar|drug|(?:general |)election|espionage|(?:central |local |municipal |)government|heroin|marine|coal|oil|parliament|petroleum|people|population(?: density|)|political party|(?:political |economic |super|)power|liberal|(?:capital|commun|fasc|liberal|national|social)is[mt]|republic|revolution|war|worker|world|pound|yen|yuan|euro)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(arm|colon|democrac|ecolog|econom|industr|militar|monarch|monopol|nav)(ies|y)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:colony|colonialism)\|(colon(?:ial|ialism|ies|y))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:capital|commun|fasc|liberal|national|social)ism\|((?:capital|commun|fasc|liberal|national|social)ists?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[political (?:corruption|party)\|(corrupt(?:ion|)|party)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[People of the United States\|(American)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:USA?|United States(?: of America|)|U\.S\.)\|([^\]]{8})\]\]/gi, 'US');
	txt.value=txt.value.replace(/\[\[(USD|US$|U\.?S\.? dollars?|United States dollars?)\|([^\]]+?)\]\]/gi, 'US$');
	txt.value=txt.value.replace(/\[\[((US|United States|U\.S\.)\sdollar|USD|US\$|\$)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(?:United Nations|UN|U\.N\.|UNO|U\.N\.O\.)\]\] \[\[(?:United Nations|U.N.) (General Assembly|Secretar(?:iat|y General)|Security Council)\]\]/g, '[[UN $1]]');
	txt.value=txt.value.replace(/\[\[United Nations\|(UN|U\.N\.|UNO|U\.N\.O\.)\]\]/g, 'UN');
	txt.value=txt.value.replace(/\[\[(United Nations|UN|U\.N\.|UNO|U\.N\.O\.)\]\]/g, '$1');

	txt.value=txt.value.replace(/\[\[(?:World War I|World War II)\|(World War One|World War Two|First World War|Second World War|WWII?|The Great War)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(?:World War I|World War II)\|(first|second)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(World War I|World War II|World War One|World War Two|First World War|Second World War|WWI|WWII)\]\]/g, '$1');

	txt.value=txt.value.replace(/\[\[Olympic Games\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((summer |winter |)olympic(s|\sgames))\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[European\sUnion\|(EU|E\.U\.)\]\]/g, 'EU');
	txt.value=txt.value.replace(/\[\[(European\sUnion|EU|E\.U\.)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(President of the United States|United States President|U\.?S\.?\sPresident|President of the United States of America|United States President|POTUS)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[President of the United States\|([^\]]{5,30})\]\]/gi, '$1');

//sociology, race & education
	txt.value=txt.value.replace(/\[\[(Mrs?|Dr|Rev|Sir)\.?\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(academic|class(?:room|)|campuse?|teacher|headmaster|student)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/(?:\[\[)(freshman)(?:\]\]) year/gi, 'first year');
	txt.value=txt.value.replace(/(?:\[\[)(sophomore)(?:\]\]) year/gi, 'second year');

	txt.value=txt.value.replace(/\[\[(educat(?:e[ds]?|ion|ional)|health[ -]?care|philanthrop(y|ic|ist))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(boy|girl|adolescen(?:ce|t)|teen(?:ager|)|sibling)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(foster[ -]?|god[ -]?|grand[ -]?|step[ -]?|)(family|father|mother|parent|sister|brother|sibling|husband|wife|son|daughter|cousin|child|children)(s|)\]\]/gi, '$1$2$3');
	txt.value=txt.value.replace(/\[\[(father|mother|parent|sister|brother|son|daughter|cousin)(s|)(-in-law)\]\]/gi, '$1$2$3');
	txt.value=txt.value.replace(/\[\[adolescence\|(adolescen(?:ce|t)|teen(?:ager|s|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((great[ -]?|)(aunt|uncle|niece|nephew)(s|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(African.Americans?)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[((fashion|gay|pop)\sicons?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[Native Americans in the United States\|(Native Americans?)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[professional [\w]*?\|(professional)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(celebrity|billionaire|class|conservati(sm|ve)|conservation(ist|)|poor|poverty(?: line|)|rich|millionaire|socialite)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(societ(al|y|ies))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(middle|social|upper|working)(.class)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(centrist|moderate|radical|extremist)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(left|right)(.wing(e[dr]|))\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(center|centre|extreme|far)(.)(left|right)\]\]/gi, '$1$2$3');
	txt.value=txt.value.replace(/\[\[(?:social class)\|(middle|social|upper|working)(.class|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:social class)\|(class)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((elementary|high(?:er|)|nursery|primary|secondary|tertiary)\s(schools?|education)|certificate|under-?graduate|Bachelor of Arts|Bachelor of Sciences?|Doctor of Philosophy|college|diplomas?|doctorates?|universit(?:ies|y)|post-?graduate|Master['’]?s degree|honorary degree|Oxford University|Cambridge University)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[B\.?(A|S|Sc)\.?\]\]/gi, 'B$1');
	txt.value=txt.value.replace(/\[\[Ph\.? ?D\.?\]\]/gi, 'PhD');
	txt.value=txt.value.replace(/\[\[(?:(university|master\'?s|graduate|bachelor\'?s|post-?graduate|postgrad)\sdegree)\|degree\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:Bachelor of Arts|Bachelor of Sciences?|Bachelor[\'’]?s degree|Doctor of Philosophy|Master[\'’]?s degree|Master of Arts|Master of Sciences?)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:honoris causa)\|(honorary( degree|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(research(?:er|))\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[([^\]]{1,26})\,\s(Cambridge|Oxford|London)(\sUniversity|)\|([^\]]{1,26})\]\]\,?\s\[\[(Cambridge|Oxford|London)(\sUniversity|)\]\]/g, '[[$1, $2]]');
	txt.value=txt.value.replace(/\[\[([^\]]{1,26})\,\s(Cambridge|Oxford|London)\|([^\]]{1,26})\]\]\,?\s(Cambridge|Oxford|London)(\sUniversity|)/g, '[[$1, $2]]');  

	txt.value=txt.value.replace(/\[\[(University of (Oxford|Cambridge)|Oxford University|Cambridge University)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(?:University of (?:Oxford|Cambridge))\|(Oxford|Oxford University|Cambridge|Cambridge University)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(Harvard|Yale)\]\]/g, '$1');
	txt.value=txt.value.replace(/\[\[(?:Harvard|Harvard University|Yale|Yale University)\|((Harvard |Yale)|University of (Harvard |Yale))\]\]/g, '$1');

// lifestyle & religion
	txt.value=txt.value.replace(/\[\[(alcohol(?:ic beverage|)|bar|beer|bread|brew(?:ery|ing|)|caf[eé]|cake|cheese|fast food|fat|nutrition|restaurant|smoking|wine)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[bar \((?:counter|establishment)\)\|(bar)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[tourism\|(touris[mt])\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(bible|clergy|clergym[ae]n|pastor|priest)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(alcohol(?:ism|ic|)|anniversary|birthday|exercise|gays?|god|homosexual|jesus|multi-?cultural|racis[mt]|religion|religious|travel|vegetarians?|vegetarianism)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[multiculturalism\|(multicultural)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[vegetarianism\|(vegetarians?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[christianity\|(christians?|christianity|christian\sethic|christian\sfaith)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(christianity|christians?|christian\sethic|christian\sfaith)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(?:roman\s|)catholic(?:\schurch|ism|)\|((?:roman\s|)catholic(?:\schurch|ism|s?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((catholic|protestant)(ism|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:roman\s|)catholic(?:\schurch|ism|s?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:jews|judaism)\|(jews?|jewish|judaism)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(jews?|jewish|judaism)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(birth|pregnancy|rape)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:marriage|divorce)\|([^\]]{1,15})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:married and |)maiden names?\|(née)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(marriage(?: licen[cs]e| certificate|)|marry|marries|married|married\scouples?|maiden name|née|wedding)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(divorce[des]?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(burial|cemetery|funeral|grave(?:yard|)|memorial)(s|)\]\]/gi, '$1$2');

// biology, medical, crime
	txt.value=txt.value.replace(/\[\[(male|female|doctor|nurse|patient|physician|volunteer)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(blood|skin)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(ankle|arm|brain|chest|elbow|ear|eye|face|finger|hand|hair|head|knee|leg|mouth|nose|pupil|throat|thumb|toe|waist|wrist)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(bacteri(?:um|a)|blind(?:ness|)|death|disease|epidemic|fung(?:us|i)|health|medication|medicine|viruse?)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[blindness\|(blind)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(arson|burglar(?:y|ie)|drug trafficking|forger(?:y|ie)|murder|robber(?:y|ie)|shooting|theft)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(arrest|trial|[bj]ail|execution|firing squad)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[Capital punishment\|(death(?: penalty|)|execut(?:ions?|ed?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[traffic\scollision\|(automobile\saccident|car\saccident|car\scrash|road\straffic\saccident|traffic\saccident)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(traffic\scollision|automobile\saccident|car\saccident|car\scrash|road\straffic\saccident|traffic\saccident)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(AIDS|HIV|bleed(?:ing|)|brain (damage|tumour)|(breast |lung |throat |)cancer|(?:clinical\s|)depression|coma|cough|fever|fractures?|(?:drug |)overdose|gunshot wounds?|headache|cardiac arrest|heart attack|injur(?:y|ies)|shock|stroke|suicide|surgery|vomit(?:ing|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:clinical\sdepression|depression\s\(mood\))\|(depression|depressed)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(clinical\sdepression|depression\s\(mood\)|depression|depressed)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[myocardial infarction\|(heart attack|cardiac arrest)\]\]/gi, '$1');

//music & media
	txt.value=txt.value.replace(/\[\[((print |published |mass |broadcast |news |)media)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:media \(communication\)|print media|published media|mass media|broadcast media|news media|news media \(United States\))\|((mass.|)media)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(porn|pron|pornograph(y|ic))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[pornographic actor\|((porn |)(actors?|actress(es|)|stars?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[play \(theatre\)\|(plays?|theatrical|thesbian)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[act(?:ing|or)\|([^\[\]]*)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(actor|actresse?|movie.star|thesbian|(?:title|lead|leading) role)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[model\s\((?:art|person)\)\|(model|modell?ing)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[dis[ck]\sjockey\|([^\]]{1,15})\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[spin-off \(media\)\|(spin[ -]?off)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(animation|animated film|anim.|chat|chat.show|comedy|documentar(y|ies)|drama|entertainment|episode|pen.name|game.show|live.action|new|play|plot|prime[ -]?time|reality(?: show| tv| television)|science.fiction|sci-fi|soap|soap opera|sit.?com|situation comedy|stage|spin[ -]?off|stage.name|talk.show|variety show)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(([^\s:\|]*?)[\s-]documentary)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(documentary\s([\w]*?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(([^\s:\|]*?)[\s-]documentary\s([\w]*?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:documentary film|documentary \(film\)|documentary)\|([^\]]+?)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(?:Serial \(radio and television\)|serial)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((television|tv) (films?|movies?|pilots?|programs?|series|shows?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(pilot( episode|))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:Television pilot|Pilot \(television episode\))\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((radio|tv|television) (hosts?|personality|presenters?|stations?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:radio|tv|television) (?:hosts?|personality|presenters?|stations?)\|(hosts?|personalit(ies|y)|presenters?|stations?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(([^\W\s:\]]*?)[\s-]drama)\]\]/gi, '$1');
	txt.value=txt.value.replace(/(\[\[)(Drama\s[Pp]refecture\]\])/g, '$1:$2');
	txt.value=txt.value.replace(/\[\[(drama\s([\w]*?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(([^\W\s:\]]*?)[\s-]drama\s([\w]*?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:drama|dramatic programming)\|(drama series|drama films?|tv drama|television drama)\]\]/gi, '$1');

  // rem piped music & media
	txt.value=txt.value.replace(/\[\[animat(?:ion|ed|ed film)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:documentary|documentary film)\|([^\]]+?)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(?:sitcom|situation comedy)\|([^\]]+?)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(?:television\sprogram|tv program)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:talk|chat).show\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[([^\W\s:\]]*?\s?)(television series|television film?|television show?|tv series|television\sprogram|tv program|television\ssitcom|tv sitcom)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:television series|television film?|television show?|tv series|television\sprogram|tv program|television\ssitcom|tv sitcom)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:reality\stelevision|reality\sshow|reality\stv)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:rock\smusic|rock\s\(music\))\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[pop\smusic\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:singing|singer)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(soundtrack)(\salbum|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[solo \(music\)\|(solo)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(audio ?tape|cassette|DVD|LP|VHS|video|music video|compact\sdis[ck]|CD|C\.D\.|Compact Disc single|C\. D\. single|CD single)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[compact\sdis[ck]\|(?:CD|C\.D\.)(s|)\]\]/gi, 'CD$1');
	txt.value=txt.value.replace(/\[\[(CDROM)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(albums?|album track|albums? \(music\)|record albums?)\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:debut |double |live |music |record  |self.titled debut |sophomore |studio |)album)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[((music|radio|recording|tv|television) studio)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:(?:music|radio|recording|tv|television) studio)\|([^\]]+?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(Facebook|MTV|MySpace|Twitter|You\s?Tube)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(singing|singer|vocal|vocalist|Pop\ssinger|Female\svocals|Songstress|Clean\svocals|Singer\s\(music\)|Pop\ssinger)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(lead\svocalist|lead\svocals|lead\ssinger|front.m[ae]n)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(backing\svocalist|backing\svocals|backing\ssinger)(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\[\[(?:(?:backing\s|lead\s|)(?:singer|vocalist|vocals))\|((?:backing\s|lead\s|)(?:singer|vocal(ist|))s?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(rock\smusic|rock|rock\smusician|rock\sgroup|rock\sstandard|rawk|rock\ssong|rock\santhem|rockmusic)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(pop\smusic|pop|pop\smusicians?|pop\sgroups?|pop\ssongs?|pop\smusic|pop\s\(music\)|popmusic|pop\smusic\s\(genre\)|new\spop)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(?:band\s\(music\)|group\s\(music\)|musical\sensemble)\|([^\]]+?)\]\]/gi, '$1'); 
	txt.value=txt.value.replace(/\[\[(musical\sensemble|group|band|rock\sbands?|Instrumental\sensemble|Rock\sgroups?|list\sof\smusical\sensembles|musical\sgroup|music\sband|music\sgroup|musical\sband|bar\sband|group\s\(music\)|musical\sensembles?|music\sensemble|band\s\(music\)|pop\sband)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(guitars?|guitarists?|guitar music|blues guitar|electric guitar|lead\sguitars?|rhythm\sguitars?|rock guitar)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(?:bass\s|electric\s|lead\s|rhythm\s|)guitar\|([^\]]+?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(bass|bassist|bass guitarists?|electric\sbass|metal\sbass|bass\s\(guitar\)|electric\sbass\sguitar|Alternate\sbass|bass\sguitars?|electric\sbass\sguitar|fretless\sbass\sguitar|base\sguitar|bass\sguitar\s\(instrument\))\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[keyboard\sinstrument\|(keyboards?|keyboardists?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(keyboard\sinstruments?|keyboards?|keyboardists?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[drum ?kit\|(drums?|drumkits?|drumming|drummers?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(drum ?kit|drums?|drumkits?|drumming|drummers?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[percussion\sinstrument\|(percussions?|percussionists?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(percussion\sinstrument|percussions?|percussionists?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[wind\sinstrument\|(wind\sinstruments?|wind)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(wind\sinstruments?|wind)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[woodwind\sinstrument\|(woodwind\sinstruments?|woodwind)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(woodwind\sinstruments?|woodwind)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[violin\|(violinists?|violins?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(violins?|violinists?|violin music)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[cello\|(cellists?|cellos?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(cellos?|cellists?|cello music)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[fashion\sdesign\|(fashion\sdesigner|designers?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(fashion|fashion\sdesign|fashion\sdesigners?|designers?)\]\]/gi, '$1');

	txt.value=txt.value.replace(/\[\[(box office|concert)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[film\|(films?|filming|movies?|big\sscreen|motion pictures?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(films?|filming|movies?|big\sscreen|motion pictures?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[film\sdirector\|(film\sdirector|director)\]\]/gi, '$1');
//	txt.value=txt.value.replace(/\[\[Television\sdirector\|(television\sdirector|tv director|director)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:film|television|tv|music|record|stage)\sdirect(?:ors?|ion)\|((film |television |tv |stage |music |record |)directors?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[music\sarranger\|(music\sarranger|arranger)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(music\sarranger|music\sarranger|arranger)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(film\sdirector|director)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((film|television|tv|theat(er|re|rical)|music|radio|record).(directors?|producers?|production|studios?))\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:executive|film|music|television|tv|radio|record)\sproducer\|(produc(er|tion))\]\]/gi, '$1');

// literary
	txt.value=txt.value.replace(/\[\[poetry\|(poe[mt]s?|poetic)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(poetry|poe[mt]s?|poetic)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[hardcover\|(hard ?back|hard ?cover)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[((?:hard|paper)(?:back|cover))(s|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/Print \(Hard(back|cover) (&|and) Paperback\)/gi, 'Print (hardback & paperback)');
	txt.value=txt.value.replace(/Print \(Hard(back|cover)\)/gi, 'Print (hard$1)');

	txt.value=txt.value.replace(/\[\[(books?|essay|essayists?|non.fiction|humou?rist|novella|literature|fiction|screenplay|magazine|novels?|historical novels?|novell?ist|short story|comedy|comics?)\]\]/gi, '$1');  
	txt.value=txt.value.replace(/\[\[essay\|(essays?|essayists?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[comedy\|(comedy|comedies|comics?|comedians?|comediennes?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:novel|novella)\|(novels?|novellas?|novell?ists?)\]\]/gi, '$1');

// sport
	txt.value=txt.value.replace(/\[(football \(soccer\)|soccer)\|/gi, '[association football|');

	txt.value=txt.value.replace(/\[\[(athlete|athletics|badminton|baseball|basketball|football(ers?|\splayers?|)|golf|gymnast(ics|)|hiking|hunting|martial arts|run(ning|ners?|)|sailing|soccer|sports?|swimming|swimmer|table tennis|track and field|volleyball)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:track and field|athletics \(sport\))\|(track|field|athlet(?:ic|e)s?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(?:human swimming|swimming \(sport\))\|(swimming|swimmer|sw[aiu]ms?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[tennis\|(tennis|tennis\scourts?|tennis players?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(tennis|tennis\scourts?|tennis players?|grass courts?|clay courts?|hard courts?|grand\sslam)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[The Championships, Wimbledon\|(Wimbledon|Wimbledon championships?)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(The Championships, Wimbledon|Wimbledon|Wimbledon championships?)\]\]/gi, '$1');
//	txt.value=txt.value.replace(/\[\[US Open\s\(tennis\)\|(U\.?S\.?\sOpen)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[Grand Slam\s\(tennis\)\|(Grand Slam)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\[\[(U\.?S\.?\sOpen|French Open|Australian Open)\]\]/gi, '$1');

}

 
function Ohc_COMMON() {
  Ohc_CommonTerms();
  Ohc_COMMON_edit_summary();
}

function Ohc_COMMON_edit_summary(){
// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "per [[wp:overlinking|overlinking]]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += ", ";
		}
		txt.value += summary;
	}
	document.forms.editform.wpMinoredit.checked = true;
	document.editform.wpDiff.click();
}

$(function () {
 if(document.forms.editform) {
  mw.util.addPortletLink('p-tb', 'javascript:Ohc_COMMON()', 'Blues test', 't-commonterms', 'Removes links to common terms', '', '');
  }
});