Content deleted Content added
Ohconfucius (talk | contribs) false negatives due to detection of plain spaces instead of \s |
Ohconfucius (talk | contribs) added lines to catch repetitions |
||
Line 28:
//reflinks fixes
//citation template fixes
txt.value=txt.value.replace(/(?:\|[ ]*(?:first|agency|(?:co|)authors?|archive(?:url|date)|journal|publisher|newspaper|work|(?:access|)date|doi|month|year|___location|format|first|language|last|publisher|authorlink|volume|issue|pages?))[ ]*=[\s]*(\}|\|)/gi, '$1');
txt.value=txt.value.replace(/(?:\|[ ]*(?:first|agency|(?:co|)authors?|archive(?:url|date)|journal|publisher|newspaper|work|(?:access|)date|doi|month|year|___location|format|first|language|last|publisher|authorlink|volume|issue|pages?))[ ]*=[\s]*(\}|\|)/gi, '$1'); //repeat to catch neighbouring blank adjacent params
txt.value=txt.value.replace(/(\|[ ]*(?:agency|author|journal|publisher|newspaper|work))[ ]*=[ ]*/gi, '$1=');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\'\'\[\[([^\]]{1,40})\]\]\'\')/gi, '|work=[[$1]]');
Line 40 ⟶ 41:
//returns 'work=' for traditional media with websites
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(flightglobal\.com|Flight Global)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Flight International ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?playbill.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Playbill ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(variety.com|Variety \(magazine\)\|Variety)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Variety ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?empireonline.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Empire ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nme\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=NME |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?qthemusic\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Q |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?billboard\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Billboard ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?rollingstone.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Rolling Stone ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.(com\.au|net(?:\.au|))\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Australian Broadcasting Corporation ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=American Broadcasting Company ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?cbc\.ca\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Canadian Broadcasting Corporation ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?boston.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Boston Globe ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?businessweek\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Bloomberg BusinessWeek ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chicagotribune\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work= Chicago Tribune ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chinadaily\.com\.cn\]?\]?)(?=[\s]*[\|\}])/gi, '|work=China Daily ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chinatimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=China Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?libertytimes\.com\.tw\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Liberty Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?taipeitimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Taipei Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?udn\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=United Daily News |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people(?:daily|)\.com\.cn\]?\]?)(?=[\s]*[\|\}])/gi, '|work=People\'s Daily ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?straitstimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Straits Times |___location=Singapore ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chron\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Houston Chronicle ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(dailymail.co\.uk|Mail Online)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Daily Mail |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?denverpost\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Denver Post');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?((?:der|)spiegel\.de|spiegel online)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Der Spiegel ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?economist\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Economist ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}ew.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Entertainment Weekly ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}forbes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Forbes');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ft.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Financial Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Guardian(\.co\.uk|\sUnlimited)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Guardian |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Hello|OK)magazine\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=$2! ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?iht\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=International Herald Tribune');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,7}independent\.co\.uk\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Independent |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?independent\.ie\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Irish Independent ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?irishtimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Irish TImes ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?latimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Los Angeles Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lefigaro\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Figaro |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lemonde\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Monde |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?liberation.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Libération |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?La-Croix\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=La Croix |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LeParisien\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Parisien |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LaTribune\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=La Tribune |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lesechos\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Les Échos |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?FranceSoir\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=France Soir |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?20Minutes\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=20 Minutes |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lequipe\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=L\'Équipe |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Canardenchaîne\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Canard Enchaîné |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?NouvelObs\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Nouvel Observateur |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lexpress\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=L\'Express |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LePoint\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Le Point |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?marianne-en-ligne\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Marianne |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?parismatch\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Paris-Match |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Telerama\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Télérama |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Courrierinternational\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Courrier International |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?minute-hebdo\.fr\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Minute |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?asahi\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Asahi Shimbun |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?yomiuri\.co\.jp\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Yomiuri Shimbun |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}japantimes\.co\.jp\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Japan Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?haaretz\.(com|co\.il)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Haaretz |___location=Israel');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?jpost\.(com|co\.il)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Jerusalem Post ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Telegraphindia.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Telegraph |___location=Kolkota, India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Timesofindia.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Times of India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Hindustantimes.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Hindustan Times |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(?:the)?hindu.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Hindu |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?deccanchronicle.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Deccan Chronicle |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Thestatesman.net\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Statesman |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?dailypioneer.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Pioneer |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?EconomicTimes.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Economic Times |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?tribuneindia.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Tribune |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?IndianExpress.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Indian Express |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?deccanherald.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Deccan Herald |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Expressbuzz.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The New Indian Express |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?blesk.cz\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Blesk |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ihned.cz\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Hospodářské noviny |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lidovky.cz\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Lidové noviny |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?idnes.cz\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Mladá fronta DNES |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?pravo.novinky.cz\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Právo |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?praguepost.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Prague Post |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?mingpao.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Ming Pao |___location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsday\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Newsday |___location=New York ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsweek\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Newsweek ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nydailynews\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Daily News |___location=New York ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nypost.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=New York Post ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[\b\.]{0,20}nytimes.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The New York Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=People ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?scmp.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=South China Morning Post |___location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sfgate.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=San Francisco Chronicle ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?smh\.com\.au\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Sydney Morning Herald ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?spectator\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Spectator |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}scotsman\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Scotsman |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thisislondon\.co\.uk\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Evening Standard |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sportsIllustrated\.cnn\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Sports Illustrated ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?standard\.com\.hk\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Standard |___location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thesun.co\.uk\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Sun |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?suntimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Chicago Sun-Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?telegraph\.co\.uk\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Daily Telegraph |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theage\.com\.au\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Age |___location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theaustralian\.com\.au\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Australian ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theglobeandmail\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Globe and Mail |___location=Canada ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nationalpost\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=National Post |___location=Canada ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?vancouversun\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Vancouver Sun ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thestar\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Toronto Star ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?torontosun\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Toronto Sun ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?time.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=TIME ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Timesonline\.co\.uk|Times ?online)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Times |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}usatoday\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=USA Today ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtonpost\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Washington Post ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtontimes\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Washington Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}wsj\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=The Wall Street Journal ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}un\.org\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=United Nations ');
//returns 'work=' for traditional media; delinks and dabs ___location
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[((?:the |)(Globe and Mail|National Post|Vancouver Sun|Le Devoir|Le Droit))\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Canada ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(the )?((Sunday )?Times|Daily (Mail|Mirror|Express)|Independent|Observer|Guardian|NME|New Musical Express|New Statesman|Scotsman|Spectator|Daily Telegraph)\]\])(?=[\s]*[\|\}])/gi, '|work=$1$2 |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(?:The Sun|Daily Star) \((?:United Kingdom|newspaper)\)\|(The Sun|Daily Star)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(apple daily|ming pao|The standard|south china morning post)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[The standard\|[^\]]*\]\])(?=[\s]*[\|\}])/gi, '|work=The Standard |___location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(The Age|Herald Sun)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(Asahi Shimbun|Yomiuri Shimbun)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(?:the |)(Irish |Japan |Taipei |Taiwan )Times\]\])(?=[\s]*[\|\}])/gi, '|work=The $1Times ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(La Croix|Le Figaro|L'Humanité|Libération|Le Monde|Le Parisien|La Tribune|France Soir|Direct Matin|Direct Soir|L'Équipe|Le Canard enchaîné|Le Nouvel Observateur|L'Express|Le Point|Paris-Match|Télérama|Courrier International)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(Avvenire|Corriere della Sera|Il Fatto Quotidiano|Il Foglio|il Giornale|Il Giorno|il manifesto|Il Mattino|Il Messaggero|il Resto del Carlino|il Riformista|Il Secolo XIX|Il Tempo|La Nazione|la Repubblica|La Stampa|L'espresso|Corriere del Mezzogiorno)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Italy');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(The |)(Times of India|Hindustan Times|Hindu|Deccan Chronicle|Statesman|Daily News and Analysis|Economic Times|Tribune|Indian Express|Deccan Herald|New Indian Express|Asian Age)\]\])(?=[\s]*[\|\}])/gi, '|work=$1$2 |___location=India');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Telegraph \(Kolkata\)\|(The Telegraph)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Kolkota, India ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Pioneer \(Indian newspaper\)\|(The Pioneer)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=India ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(Blesk|Hospodářské noviny|Lidové noviny|Mladá fronta DNES|Právo|(?:The |)Prague Post)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(the |)((sunday )?Times|daily (mail|mirror|express)|(?:London |)Evening Standard|independent|observer|guardian|NME|New Musical Express|New Statesman|Scotsman|Spectator|Daily Telegraph))(?=[\s]*[\|\}])/gi, '|work=$1$2 |___location=UK |');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[\[(?:The |)Straits Times\]\])(?=[\s]*[\|\}])/gi, '|work=Straits Times |___location=Singapore ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(China Times|Liberty Times|(?:The |)China Post|United Daily News)\]\])(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Taiwan (ROC)');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(apple daily|ming pao|(?:The |Hong Kong |hk ?)standard|south china morning post))(?=[\s]*[\|\}])/gi, '|work=$1 |___location=Hong Kong |');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\[\[The standard\|hk standard\]\])(?=[\s]*[\|\}])/gi, '|work=The Standard |___location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?the age)(?=[\s]*[\|\}])/gi, '|work=The Age |___location=Australia');
//returns 'work=' for traditional media not requiring ___location dab
txt.value=txt.value.replace(/(?:\|\s?(?:publisher|work)\s?\=\s?\[\[(the )?(Billboard|Billboard Magazine|boston globe|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(?:\smagazine|)|Financial Times|FT|(?:The |)Globe and Mail|(?:The |)Vancouver Sun|Guardian|Hello!|International Herald Tribune|iht|(?:los angeles|la) times|le figaro|le monde|lib[ée]ration|mojo|newsday|newsweek|nydailynews|new york(?: daily news| Post| Times|er)|Q magazine|rolling\sstone|scmp|south china morning post|(?:San Francisco|sf) Chronicle|Sports Illustrated|Sydney Morning Herald|smh|Chicago Sun.Times|the australian|Ottawa Citizen|Ottawa Sun|toronto (?:star|sun)|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal)\]\])(?=[\s]*[\|\}])/gi, '|work=$1$2');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?((?:bloomberg |)business\s?week)(?:\]\])?)(?=[\s]*[\|\}])/gi, '|work=$1 ');
txt.value=txt.value.replace(/(?:\|\s?(?:publisher)\s?\=\s?(the |)(Billboard|Billboard Magazine|boston globe|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(?:\smagazine|)|Financial Times|FT|(?:The |)Globe and Mail|(?:The |)Vancouver Sun|(?:The |)Guardian|Hello!|International Herald Tribune|iht|(?:los angeles|la) times|le figaro|le monde|lib[ée]ration|mojo|newsday|newsweek|nydailynews|new york(?: daily news| Post| Times|er)|Q magazine|rolling\sstone|scmp|south china morning post|(?:San Francisco|sf) Chronicle|Sports Illustrated|Sydney Morning Herald|smh|Chicago Sun.Times|the australian|Ottawa Citizen|Ottawa Sun|toronto (?:star|sun)|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal))(?=[\s]*[\|\}])/gi, '|work=$1$2');
//returns 'publisher=' for new media news magazines
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Huffington Post)(?:\]\])?)(?=[\s]*[\|\}])/gi, '|work=$1 |___location=USA');
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Digitalspy.co.uk)(?:\]\])?)(?=[\s]*[\|\}])/gi, '|work=Digital Spy |___location=UK');
//returns 'publisher=' for electronic media
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(bbc.co.uk)(?:\]\])?)(?=[\s]*[\|\}])/gi, '|publisher=BBC');
// txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}(bbc\.co\.uk)\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=BBC ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(?:\[\[)(bbc( sports?| news(?: online|)|))(?:\]\]))(?=[\s]*[\|\}])/gi, '|$1=$2 ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(bbc( sports?| news(?: online|)|)))(?=[\s]*[\|\}])/gi, '|$1=$2 ');
txt.value=txt.value.replace(/(=[ ]?BBC News)( online|\.com)(?=[\s]*[\|\}])/gi, '$1');
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|publisher|work)\s?\=\[\[(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|(?:American|Australian|Canadian|British) Broadcasting Corporation|Bloomberg|Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|xinhua( news agency)?|Yahoo!?|You\s?Tube)\]\])(?=[\s]*[\|\}])/gi, '|publisher=$1');
txt.value=txt.value.replace(/(?:\|\s?(?:work|newspaper)\s?\=(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|(?:American|Australian|Canadian|British) Broadcasting Corporation|Bloomberg[ ]*\||Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|xinhua( news agency)?|Yahoo!?|You\s?Tube))(?=[\s]*[\|\}])/gi, '|publisher=$1');
//Television media and networks
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(BBC (?:One|Two|Three|Four|Five|Six)|Channel [45])\]\])(?=[\s]*[\|\}])/gi, '|$1=$2 |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Channel Five \(UK\)\||)(Channel Five|Channel 5)\]\])(?=[\s]*[\|\}])/gi, '|$1=Channel 5 |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(Network Ten)\]\])(?=[\s]*[\|\}])/gi, '|$1=$2 |___location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Ten|Eleven) \(TV channel\)\|(Ten|Eleven)\]\])(?=[\s]*[\|\}])/gi, '|$1=$2 |___location=Australia');
//returns 'publisher=' for electronic media stripped of ___domain suffices
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?ap\.org\]?\]?)(?=[\s]*[\|\}])/gi, '|agency=Associated Press ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?afp\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|agency=Agence France-Presse ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?reuters\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|agency=Reuters ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?kyodonews\.jp\]?\]?)(?=[\s]*[\|\}])/gi, '|agency=Kyodo News ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?xinhuanet\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|agency=Xinhua News Agency ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?aljazeera\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Aljazeera');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?bloomberg\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Bloomberg ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}cnn\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=CNN ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}espn(\.go)?.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=ESPN ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?foxnews\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Fox News');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?huffingtonpost\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=Huffington Post ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?msnbc\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=MSNBC');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?books.google\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Google Books');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}google\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|publisher=Google ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?(mtv|twitter|vh1|youtube)\.com\]?\]?)(?=[\s]*[\|\}])/gi, '|work=\'\'$2\'\'');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?((?:[\w]*\.|)Europa\.eu|Europa \(web portal\)\|Europa)\]?\]?)(?=[\s]*[\|\}])/gi, '|work=\'\'Europa (web portal)\'\'');
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|publisher|work)\s?\=\s?(?:\[\[|)(AF?P\b|Associated Press|Agence France-Presse|Kyodo ?News|Reuters)(?:\]\]|))(?=[\s]*[\|\}])/g, '|agency=$1 ');
txt.value=txt.value.replace(/\[\[(ABC|AP|AFP)\]\]/g, '$1');
//linked publishing houses
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?Hachette Filipacchi Médias\|(Hachette Filipacchi) \(UK\) Ltd\]?\]?)(?=[\s]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?(John Fairfax (and Sons Ltd\.?|Holdings)|Fairfax(?: Media( Limited)| Digital| newspapers))\]?\]?)(?=[\s]*[\|\}])/gi, '');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(\[\[|)(Associated Newspapers|Fairfax Media|(Guardian|Telegraph) Media Group|IPC Media|(The |)New York Times Company|News (?:Corporation|International)|Trinity Mirror|MTV Networks|Nielsen Business Media(, Inc\.?|))(\]\]|))(?=[\s]*[\|\}])/gi, '');
// removing redundancies
txt.value=txt.value.replace(/\|\s?___location\s?\=\s?(?:London|UK)\s?(\|[^}]*|)\|\s?___location\s?\=\s?(?:London|UK)/g, '|___location=UK $1');
txt.value=txt.value.replace(/\|\s?___location\s?\=\s?USA\s?(\|[^}]*|)\|\s?___location\s?\=\s?USA/g, '|___location=USA $1');
txt.value=txt.value.replace(/\|\s?___location\s?\=\s?New York(?: City|)\s?(\|[^}]*|)\|\s?___location\s?\=\s?(New York(?: City|)|USA)(?=[\s]*[\|\}])/g, '|___location=New York $1');
// txt.value=txt.value.replace(/\|\s?language\s?\=\s?English/gi, ''); //false positive in infoboxes for books
txt.value=txt.value.replace(/- [\w]*\.com[ ]*\|/gi, '|');
txt.value=txt.value.replace(/\|\s?
txt.value=txt.value.replace(/\|\s?publisher\s?\=\s?
|