regex(/(\|\s*(?:publisher|website)\s*\=\s*)w{3}\.(\w+\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))(?=\s*[|}])/gi, '$1$2');
regex(/(\|\s*publisher=)\s?\|\s?via\s*\=\s*(\w+)(?=\s*[|}])/gi, '$1$2');
// regex(/\|\s?via\s*\=\s*/gi, '|work='); ▼
regex(/\s?[-–]\s?(?:The |)(\w+\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\s?(\|\s*publisher\s*\=\s*)\1(?=}})/gi, '$2$1');
regex(/\s?[-–]\s?([^|]+)\s?(\|\s*publisher\s*\=\s*)(The )\1(?=}})/gi, '$2$3$1');
// removing http links within publisher/journal/work fields
//
// regex(/(\|\s*(?:author|publisher|work) *= *)(?:https?:\/{2}|)(?:w{3}\.|)(\w+(?:\.(?:com?|net|org|gov|\w{2})|)(?:\.\w{2}|))(?:\/[^|}]*|)(?=\s*[\]|}])/gi, '$1$2'); //returns ___domain name
regex(/(\|\s*title\s*\=)\s*https?:\/{2}(?:w{3}\.|)\w+\.com(?=\s?(?:[=|{]|\}\}))/gi, '$1 ');
regex(/(\|\s*title\s*\=)\s*https?:\/{2}[^|\s]+(?=\s?(?:[=|{]|\}\}))/gi, '$1 ');
// regex(/(\|\s*title\s*\=)\s*Archived copy(?=\s?(?:[=|{]|\}\}))/gi, '$1 '); rem as creating CS1 errors
regex(/\s?<!--ACTUAL ARTICLE TITLE BELONGS HERE!(?: original text:|)[^>]*-->/gi, ' '); //rem error introduced by earlier version of this script; entirely strip title field
//citation template fixes
// regex(/(\|\s*)published\s?=/gi, '$1publisher='); //disabled 12/5/21 – false positive in book infobox
// rem copyright assertion
regex(/(\|\s*publisher\s*\=\s*)(?:\[\[copyright(?:\|©|)\]\])\s?/gi, '$1');
// reordering 'work' and 'publisher' (first run - see second run in cleanup function)
regex(/(\|\s*publisher\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(\s?\|[^}<>]*|)(\|\s*(?: journal|newspaper|magazine|periodical|website|work)\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(?=[\s\.]*[|}])/g, '$3$1$2');
regex(/(\|\s*website\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(\s?\|[^}<>]*|)(\|\s*(?: journal|newspaper|magazine|periodical|work)\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(?=[\s\.]*[|}])/g, '$3$1$2');
/// removing identical/similar entries in 'work' and 'publisher', and in 'work' and 'website' (different default vs [post] cleanup rules)
regex(/\|\s?work\s*\=\s*([^=|}\[<>]*)(\|[^}<>]*|)\|\s?(?:publisher|website)\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unlinked work
regex(/\|\s?work\s*\=\s*\[\[([^<|\]]*)\]\](\|[^}<>]*|)\|\s?(?:publisher|website)\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unpiped work
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<|\]]*)\|([^}<>]*)\]\])(\|[^}<>]*|)\|\s?(?:publisher|website)\s*\=\s*(\1|\2)\.?(?=\s*[|}])/g, '|publisher=$1$3'); //piped work
regex(/\|\s?publisher\s*\=\s*([^=|}\[<>]*)(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unlinked work
regex(/\|\s?publisher\s*\=\s*\[\[([^<|\]]*)\]\](\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unpiped work
regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^<|\]]*)\|([^}<>]*)\]\])(\|[^}<>]*|)\|\s?publisher\s*\=\s*(\1|\2)\.?(?=\s*[|}])/g, '|publisher=$1$2'); //piped work
// remove redundant parentheses and templates from dm and md dates (equivalents also exists in Mosnum script)
// adjust for possibly incorrectly input title
regex(/(\|\s*title\s*\=\s*)([^\|\}<>]*)(\s?\|[^}<>]*|)\|\s?(publisher|work)\s*\=\s*(?:\1|\[\[\1\]\])(?=\s*[|}])/g, '$1 |$4=$2$3'); //creating deliberate error (blank title) per Trappist
// rem misplaced punctuation
regex(/(<ref[^>]*>[^<]+?[\]\.\},;–]\s*\'\'[\w-]*(?: [\w-]*){0,3})(\.com|)([;,\.])(\'\')(?=[^<]*?<\/ref>)/gi, '$1$2$4$3');
regex(/([\w]+)\.(['"]\])[ ]/gi, '$1$2. '); //LQ for titles
// removing blank or redundant parameters
regex(/(?:\|[ ]*(?:agency|arxiv|asin|at|author(-?link|-mask|-name-separator|-separator|\d|\d-link|link\d?|)|bibcode|chapter|chapter-url|coauthors?|contribution(?:-url|)|date|deadurl|display-authors|doi|doi-inactive|doibroken|edition|(?:editor|translator)(?:-first|-last|-link|\d|\d-first|\d-last|\d-link)|(?:first|last)\d?|format|id|is[bs]n|issue|jfm|journal|jstor|language|lay(?:date|source|summary)|lccn|___location|magazine|day|month|mr|newspaper|nopp|oclc|ol|origyear|osti|others|pages?|periodical|place|pm[cd]|pmid|postscript|publisher|quote|ref|rfc|separator|series|ssrn|trans_title|type|url|volume|via|work|year|zbl)[ ]*=[\s]*)(?=[}|])/gi, '');
regex(/(\|\s*work\s?\=\s?)\[\[iTunes\]\] Archive\s/gi, '|publisher=[[iTunes]]'); ▼
// regex(/(?:\|[ ]*(began|ended)[ ]*=[^}|]*)(?=[}|])/gi, ''); //disabled 18/06/20: false positive removal of associated (Start date) templates
▲ regex(/(\|\s*work\s?\=\s?)\[\[iTunes\]\] Archive\s/gi, '|publisher=[[iTunes]]');
//rem underlining within certain fields
//'work' and its alias (pre)
regex(/(\|[ ]*?newspaper[ ]*=[^\|}]*(?:\|[^\{\}]*|))(?:\|[ ]*?work[ ]*=[^|}]*)(?=[|}])+/gi, '$1');
//rem linking within '___location' field
regex(/(\|[ ]*?(?:___location|place)=[ ]*?)\[\[ ?(Abkhazia|Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barbuda|Argentina|Armenia|Australia|Austria|Azerbaijan|(?:The |)Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|(?:(?:People's |)Republic of |)China|Colombia|Comoros|(?:Democratic |)Republic of (?:the |)Congo|Costa Rica|Côte d'Ivoire|Croatia|Cuba|Cyprus|Czech Republic|(?:Kingdom of |)Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Georgia \(country\)|Germany|Ghana|Greece|Greenland|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|(?:Republic of |)Ireland|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|North Korea|South Korea|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|(?:Republic of |)Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|Myanmar|M[ée]xico|(?:Federated States of |)Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Nagorno-Karabakh|Namibia|Nauru|Nepal|(?:Kingdom of the |)Netherlands|Holland|New Zealand|Nicaragua|Niger|Nigeria|Northern Cyprus|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|SADR|Saint Kitts and Nevis|Saint Lucia|Saint Vincent and the Grenadines|Samoa|San Marino|São Tomé and Príncipe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|Somaliland|South Africa|South Ossetia|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Timor Leste|(?:The |)Gambia|Togo|Tonga|Transnistria|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezuela|Vietnam|Yemen|Zambia|Zimbabwe)[ ]?\|[ ]?(?:\w{2,3})\]\]/gi, '$1$2');
regex(/(\|[ ]*?(?:___location|place)=[ ]*?)\[\[(?:[^\|\]]+?\||)([\w\s\,]+?)\]\](?:(,? )\[\[(?:[^\|\]]+?\||)([\w\s\,]+?)\]\])(?:(,? )\[\[(?:[^\|\]]+?\||)([\w\s\,]+?)\]\]|)(?=[ ]?[|}])/gi, '$1$2$3$4$5$6');
regex(/(\|[ ]*?(?:___location|place)=[ ]*?)\[\[(?:[^\|\]]+?\||)([\w\s\,]+?)\]\](?:(,? )\[\[(?:[^\|\]]+?\||)([\w\s\,]+?)\]\]|)(?=[ ]?[|}])/gi, '$1$2$3$4');
// removing english language parameters
regex(/[ ]?\{\{en[- ]icon\}\}/gi, "");
// regex(/\|[ ]*?language[ ]*?=[ ]*?en(?:-\w{2}|glish|)(?=\s*[}|])/gi, "");
// regex(/(\|[ ]*?language[ ]*?=[ ]*?)\{\{(\w{2})(?:[- ](?:icon|UK|GB|US)|)\}\}/gi, ""); // removing icon template from within "|language=" parameter
// eliminating time of day
//pre-dab of piped sources
// regex(/(\[\[)(?:foo|bar)(\|)/gi, '$1foo bar \(dab\)$2');
regex(/(\[\[)(?:(?:British|English|London) Sun|Sun on Sunday|The Scottish Sun|(?:The |)Sun (?:\((?:British |)newspaper\)|\(tabloid\)|\(UK newspaper\)|\(UK\)|Newspaper|on Sunday|Online)|Thesun\.co\.uk)(?=\|)/gi, '$1The Sun (United Kingdom)');
regex(/(\[\[)Daily Star \((?:British|UK)\)(?=\|)/gi, '$1Daily Star (United Kingdom)');
regex(/(\[\[Metro)(?: \(Associated Metro Limited\)| \(Associated Newspapers\)| \(London newspaper\)| \(free London newspaper\)| UK| newspaper London| newspaper UK)(?=\|)/gi, '$1 (British newspaper)');
regex(/(\[\[)(?:Calcutta Telegraph|The Telegraph \((?:Calcutta|India)\)|(?:The |)Telegraph India|Telegraphindia\.com)(?=\|)/gi, '$1The Telegraph (Kolkata)');
regex(/(\[\[)Dawn(?:, Karachi| newspaper|\.com| \((?:Newspaper|Pakistan)\))(?=\|)/gi, '$1Dawn (newspaper)');
regex(/(\[\[The Pioneer)(?:, Karachi| newspaper| \((?:indian newspaper)\))(?=\|)/gi, '$1 (Indian newspaper)');
regex(/(\[\[)dailypioneer.com(?=\|)/gi, '$1The Pioneer (Indian newspaper)');
regex(/(\|)(Sport \()(newspaper\))(?=\||\]\])/g, '$1$2Spanish $3'); //dab moved December 2012
regex(/(=[ ]*\[\[)(?:[BE]SPN ?(?:USA|HD|Network|the ocho|\(United States\))|E.S.P.N.|(?:The |)Entertainment (?:and |)Sports Programming Network)(?:\|[\w, ]*)(?=\]\])/gi, '$1ESPN');
regex(/(\[\[)Sky ?(?:\((?:British|UK)\)|UK|United Kingdom)(?=\|)/gi, '$1Sky (United Kingdom)');
regex(/(?:agency|journal|newspaper|periodical|publisher|website|work)(\s?=\s?\[\[)(?:MTV (?:[A-Z]\w*|\([^\)\]]*\)))\|[^\)\]]*(?=\]\])/gi, 'publisher$1MTV');
//unwinding of unnecessary pipes
regex(/\[\[Public Broadcasting Service\|(PBS\]\])/gi, '[[$1');
}
//linked publishing houses
// removing publishers less well-known than their titles
regex(/(\|\s*publisher\s?\=MTV\|\s?)publisher\s*\=\s*(?:MTV Networks(?: \(Viacom\)|)|Viacom)/gi, '$1=');
regex(/(?:\|publisher=Turner Sports Interactive, Inc)\.? ?\|publisher=(NBA)(?= ?\|)/gi, '$1');
regex(/(\|publisher=NBA) ?\|publisher=(?:Turner Sports Interactive, Inc)\.?(?= ?\|)/gi, '$1');
regex(/\[\[Jann? Wenner\|Wenner Media\]\](?= ?\|)/gi, '');
// removing publishers for periodicals
regex(/\|publisher=\[\[(?:PMC \(company\)\||)(?:PMC|Penske Media Corporation)\]\](?=[\s\.]*[|}])/gi, '');
regex(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[?\[?(?:Hachette Filipacchi Médias\||)Hachette Filipacchi(?: \(UK\) Ltd.?| UK|)\]?\]?)(?=[\s\.]*[|}])/gi, '');
regex(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*(ACP Magazines|The Herald and Weekly Times|John Fairfax (and Sons Ltd\.?|Holdings)|Fairfax(?: Media(?: Limited|)| Digital| newspapers|)))(?=[\s\.]*[|}])/gi, '');
regex(/(?:\|\s?(newspaper|work|publisher)\s*\=\s*\[\[(ACP Magazines|The Herald and Weekly Times|John Fairfax (and Sons Ltd\.?|Holdings)|Fairfax(?: Media(?: Limited|)| Digital| newspapers))\]\])(?=[\s\.]*[|}])/gi, '');
regex(/\| ?publisher ?= ?(?:Fandango Media|\[\[Fandango Media\]\]) ?/gi, '');
regex(/(?:\|\s?publisher\s*\=\s*(Alexander Lebedev|American Media|Associated Newspapers|Bauer (?:Consumer Media|Media Group)|Cond[eé] Nast(?: Publications|)|Daily Mail and General Trust|Devin Laz[ae]rine|Dow Jones & Company|Future plc|(Guardian|Telegraph) Media Group|(?:Guardian|Independent) News (?:and|&) Media(?: Limited| Ltd\.|)|Hachette Filipacchi Médias|Hearst (?:Corporation|Magazines(?: UK|))|Herald Media|IGN Entertainment|Imdb Inc\.?|InterMedia Partners|IDG|IPC Media|Lee Enterprises|Media ?News Group|Mediacorp|Mortimer Zuckerman|MTV Networks|News (?:Corporation|International|Limited)|Postmedia Network Inc\.?|Prometheus Global Media|Reed Business Information|Rovi Corporation|Trinity Mirror|Times Newspapers|Nielsen (?: Media Research|Business Media)|Viacom|Time(?: Warner ?|)))(,? Inc| LL[CP]| Ltd|Limited|)[\s\.]*(?=[|}])/gi, '');
regex(/\|\s?publisher\s*\=\s*(?:The |)(?:Deseret News Publishing|Dispatch Printing|E\. W\. Scripps|Evening Post Publishing|Forbes(?: Publishing|, Inc\.)|Gannett?|Independent News & Media|Irish Times Trust|(?:Jann Wenner|Wenner Media)|Johnson Publishing|Journal Communications|Mac Publishing|Media24|McClatchy|Nash holdings LLC|New York Times|Seattle Times|Star Tribune|Thomp?son(?:[- ]?Reuters)?(?: Corporation| Plc.?|)|Singapore Press Holdings|Torstar|Time Inc\.|Times (?:Group|Publishing)|Tribune|Vox Media|Washington Post|World Publishing|Ziff Davis Media)(?: Co(?:mpany|\.)?)?(?=[\s\.]*[|}])/g, '');
regex(/\|\s?publisher\s*\=\s*(?:Cox|Halifax|North Jersey|Sun-Times|Tampa|Herald|Stephens|WEHCO) Media(?: Group(?:,? Inc\.)?| Berhad)?(?=[\s\.]*[|}])/g, '');
// regex(/\|\s?publisher\s*\=\s*(?:\w+ )+(?:Media|Publishing|Publications)(?: Group(?:,? Inc\.)?| Berhad)(?=[\s\.]*[|}])/g, ''); //rem "Communications" - false positive for "Ministry of Economic Affairs and Communications" reported 28 May 2014
//duplicate above with links //("Corporation" excluded - false positive with Australian Broadcasting Corporation)
regex(/(?:\|\s?publisher\s*\=\s*\[\[(Alexander Lebedev|American Media|Associated Newspapers|Bauer (?:Consumer Media|Media Group)|Cond[eé] Nast(?: Publications|)|Daily Mail and General Trust|Devin Laz[ae]rine|Dow Jones & Company|Future plc|(Guardian|Telegraph) Media Group|(?:Guardian|Independent) News (?:and|&) Media(?: Limited| Ltd\.|)|Hachette Filipacchi Médias|Hearst (?:Corporation|Magazines(?: UK|))|Herald Media|IGN Entertainment|Imdb Inc\.?|InterMedia Partners|IDG|IPC Media|Lee Enterprises|Media ?News Group|Mediacorp|Mortimer Zuckerman|MTV Networks|News (?:Corporation|International|Limited)|Postmedia Network Inc\.?|Prometheus Global Media|Reed Business Information|Rovi Corporation|Trinity Mirror|Times Newspapers|Nielsen (?: Media Research|Business Media)|Viacom|Time(?: Warner ?|)))(,? Inc| LL[CP]| Ltd|Limited|)(?:\|[^\]\}]*|)\]\][\s\.]*(?=[|}])/gi, '');
regex(/\|\s?publisher\s*\=\s*\[\[(?:The |)(?:Deseret News Publishing|Dispatch Printing|E\. W\. Scripps|Evening Post Publishing|Forbes(?: Publishing|, Inc\.)|Gannett?|Independent News & Media|Irish Times Trust|(?:Jann Wenner|Wenner Media)|Johnson Publishing|Journal Communications|Mac Publishing|McClatchy|Nash holdings LLC|New York Times|Seattle Times|Star Tribune|Thomp?son(?:[- ]?Reuters)?(?: Corporation| Plc.?|)|Singapore Press Holdings|Torstar|Time Inc\.|Times Publishing|Tribune|Vox Media|Washington Post|World Publishing|Ziff Davis Media)(?: Co(?:mpany|\.)?)?\]\](?=[\s\.]*[|}])/g, '');
regex(/\|\s?publisher\s*\=\s*\[\[(?:Cox|Halifax|North Jersey|Sun-Times|Tampa|Herald|Stephens|WEHCO) Media(?: Group(?:,? Inc\.)?| Berhad)?\]\](?=[\s\.]*[|}])/g, '');
// regex(/\|\s?publisher\s*\=\s*\[\[(?:\w+ )+(?:Media|Publishing|Publications)(?: Group(?:,? Inc\.)?| Berhad)\]\](?=[\s\.]*[|}])/g, '');
regex(/\| ?publisher ?= ?Star Publications \(Malaysia\)|\[\[Star Publications \(Malaysia\)\]\] ?/gi, '');
regex(/\| ?publisher ?= ?(?:New Straits Times Press|\[\[New Straits Times Press\]\]) ?/gi, '');
regex(/(\|\s*publisher\s?\=\s?MTV\s?)\|\s*\=\s*\(\w+\)/gi, '$1='); //palliative - correction for unsuppoeted parameters
}
var txt=document.editform.wpTextbox1;
// The following regexes for dab-links are in sets of four. If changing, please ensure all sets are changed )note (unique regex line for Empire film magazineadded 20/6/2021)
regex(/(=[ ]*(?:The ?|)[A-Z]\w*(?: [A-Z]\w*|)) \((South Africa)(?:n newspaper|)\)([ ]*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:The ?|)[A-Z]\w*(?: [A-Z]\w*|)) \((South Africa)(?:n newspaper|)\)(''[\.,;])/g, '$1$3$2');
regex(/(\[\[((?:The ?|)[A-Z]\w*(?: [A-Z]\w*|)))( \(South Africa(?:n newspaper|)\))(\]\][\.,;]?)/g, '$1$3|$2$4');
regex(/(\|)((?:The ?|)[A-Z]\w*(?: [A-Z]\w*|))(?: \((?:South Africa)(?:n newspaper|)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Advertiser) \((Adelaide)\)([ ]*[|}])/g, '$1|___location=$2$3');
regex(/(''The Advertiser) \((Adelaide)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Advertiser)(?: \((Adelaide)\))(\]\])/g, '$1$2$4|___location=$3');
regex(/(\[\[)(The Advertiser)( \((Adelaide)\))(\]\])/g, '$1$2$3|$2$5|___location=$4');
regex(/(=[ ]*)(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \((?:magazine)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \(magazine\)(?='')/g, '$1$2'); //non-standard code
regex(/(\[\[(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired) \(magazine\))(?=\]\])/g, '$1|$2'); //non-standard code - tweaked to insert title per pipe trick
regex(/(\|)(Apollo|Billboard|Brick|Campaign|Clash|Coda|Ebony|Esquire|Essence|Fanfare|Fast Company|Fortune|Glamour|Hello!|Life|Limelight|Maxim|Mojo|Mother Jones|New York|Nuts|Paste|People|Poetry|Q|Reason|Shape|Slate|Spin|Time(?: Out|)|Variety|Wired)(?: \(magazine\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Empire) \((?:film magazine)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Empire) \(film magazine\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Empire) \(film magazine\))(?=\]\]'')/g, '$1$2'); //non-standard code
regex(/(=[ ]*\[\[(Empire) \(film magazine\))(?=\]\][ ]*\|)/g, '$1|$2'); //non-standard code (unique regex added 20/6/2021)
regex(/(\|)(Empire)(?: \(film magazine\))(?=\]\])/g, '$1$2');
//Journals
regex(/(=[ ]*)(Science|Nature) \((?:journal)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Science|Nature) \(journal\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Science|Nature) \(journal\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Science|Nature)(?: \(journal\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Quartz) \((?:publication)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Quartz) \(publication\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Quartz) \(publication\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Quartz)(?: \(publication\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Salon) \((?:website)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Salon) \(website\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Salon) \(website\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Salon)(?: \(website\))(?=\]\])/g, '$1$2');
regex(/(=[ ]*)(Stuff) \((?:company)\)(?=\s*[|}])/g, '$1$2'); //non-standard code
regex(/('')(Stuff) \(company\)(?='')/g, '$1$2'); //non-standard code
regex(/(''\[\[(Stuff) \(company\))(?=\]\]'')/g, '$1|$2'); //non-standard code
regex(/(\|)(Stuff)(?: \(company\))(?=\]\])/g, '$1$2');
regex(/(=\s*)(Daily News) \((New York)\)(?=[ ]*[|}])/g, '$1$3 $2');
regex(/(=\s*)(Daily News)\s*\|___location=\s*(New York)/g, '$1$3 $2');
// regex(/(Daily News)\s*\|___location\s*=\s*New York\s*(?=\|)/g, '$1$2$4|___location=$3');
regex(/(\[\[)(Daily News)(?: \((New York)\))(?=[\|\]])/g, '$1$3 $2');
regex(/(=[ ]*Daily Record|=[ ]*Sunday Mail) \((Scotland)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''Daily Record|''Sunday Mail) \((Scotland)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Daily Record|Sunday Mail)(?: \((Scotland)\))(\]\])/g, '$1$2$4|___location=$3');
regex(/(\[\[)(Daily Record|Sunday Mail)( \((Scotland)\))(\]\])/g, '$1$2$3|$2$5|___location=$4');
regex(/(=[ ]*(?:Daily Times)) \((Pakistan)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:Daily Times)) \((Pakistan)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Daily Times)(?: \(Pakistan\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Dawn) \((newspaper)\)(\s*[|}])/g, '$1|___location=Pakistan$3');
regex(/(''Dawn) \((newspaper)\)('')/g, '$1$3 (Pakistan)');
regex(/(\|)(Dawn)(?: \(newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*(?:Daily Star)) \((United Kingdom)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:Daily Star)) \((United Kingdom)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Daily Star)(?: \(United Kingdom\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*El Comercio) \((Equador|Peru|Spain)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''El Comercio) \((Equador|Peru|Spain)\)('')/g, '$1$3 ($2)');
regex(/(\|)(El Comercio)(?: \((?:Equador|Peru|Spain)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*El Mundo) \((Columbia|Spain)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''El Mundo) \((Columbia|Spain)\)('')/g, '$1$3 ($2)');
regex(/(\|)(El Mundo)(?: \((?:Columbia|Spain)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Daily Star) \((Lebanon)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Daily Star) \((Lebanon)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Daily Star)(?: \(Lebanon\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Gazette) \((Montreal)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Gazette) \((Montreal)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Gazette)(?: \(Montreal\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Herald) \((Glasgow)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Herald) \((Glasgow)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Herald)(?: \(Glasgow\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Mercury) \((Hobart)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Mercury) \((Hobart)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Mercury)(?: \(Hobart\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Metro) \((British newspaper)\)(\s*[|}])/g, '$1|___location=UK$3');
regex(/(''Metro) \((British newspaper)\)('')/g, '$1$3 (UK)');
regex(/(\|)(Metro)(?: \(British newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Nation) \((Malawi|Nigeria|Pakistan|Thailand)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Nation) \((Malawi|Nigeria|Pakistan|Thailand)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Nation)(?: \((?:Malawi|Nigeria|Pakistan|Thailand)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The National) \((Abu Dhabi)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The National) \((Abu Dhabi)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The National)(?: \(Abu Dhabi\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*La Presse) \((Canadian newspaper)\)(\s*[|}])/g, '$1|___location=Canada$3');
regex(/(''La Presse) \((Canadian newspaper)\)('')/g, '$1$3 (Canada)');
regex(/(\|)(La Presse)(?: \(Canadian newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Les Échos) \((France)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''Les Échos) \((France)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Les Échos)(?: \(France\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Panorama) \((Gibraltar)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''Panorama) \((Gibraltar)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Panorama)(?: \(Gibraltar\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Público) \((Portugal)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''Público) \((Portugal)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Público)(?: \(Portugal\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Público) \((Spain)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''Público) \((Spain)\)('')/g, '$1$3 ($2)');
regex(/(\|)(Público)(?: \(Spain\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Pioneer) \((Indian newspaper)\)(\s*[|}])/g, '$1|___location=India$3');
regex(/(''The Pioneer) \((Indian newspaper)\)('')/g, '$1$3 (India)');
regex(/(\|)(The Pioneer)(?: \(Indian newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Sporting Life) \((British newspaper)\)(\s*[|}])/g, '$1|___location=UK$3');
regex(/(''Sporting Life) \((British newspaper)\)('')/g, '$1$3 (UK)');
regex(/(\|)(Sporting Life)(?: \(British newspaper\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Standard) \((Hong Kong|Kenya)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(=[ ]*Today) \((Singapore newspaper)\)(\s*[|}])/g, '$1|___location=Singapore$3');
regex(/(''Today) \((Singapore newspaper)\)('')/g, '$1$3 (Singapore)');
regex(/(\|)(Today)(?: \(Singapore newspaper\))(\]\])/g, '$1$2$3');
regex(/(''The Standard) \((Hong Kong|Kenya)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Standard)(?: \((?:Hong Kong|Kenya)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Star) \((Malaysia)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Star) \((Malaysia)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Star)(?: \(Malaysia\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Sun) \((Hong Kong|Malaysia|Nigeria|United Kingdom)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''The Sun) \((Hong Kong|Malaysia|Nigeria|United Kingdom)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Sun)(?: \((?:Hong Kong|Malaysia|Nigeria|United Kingdom)\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Telegraph) \(Calcutta\)(?=\s*[|}])/g, '$1|___location=Kolkota');
regex(/(''The Telegraph) \((Calcutta)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Telegraph)(?: \(Calcutta\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*The Daily Telegraph) \(Australia\)(?=\s*[|}])/g, '$1|___location=Australia');
regex(/(''The Daily Telegraph) \((Australia)\)('')/g, '$1$3 (Australia)');
regex(/(\|)(The Daily Telegraph)(?: \(Australia\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*(?:The Daily Times)) \((Malawi)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:The Daily Times)) \((Malawi)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Daily Times)(?: \(Malawi\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*(?:The Times)) \((Malta)\)(\s*[|}])/g, '$1|___location=$2$3');
regex(/(''(?:The Times)) \((Malta)\)('')/g, '$1$3 ($2)');
regex(/(\|)(The Times)(?: \(Malta\))(\]\])/g, '$1$2$3');
regex(/(=[ ]*Vogue) \((British magazine)\)(\s*[|}])/g, '$1|___location=UK$3');
regex(/(''Vogue) \((British magazine)\)('')/g, '$1$3 (UK)');
regex(/(\|)(Vogue)(?: \(British magazine\))(\]\])/g, '$1$2$3');
regex(/(= ?(?:ABC|Marca)) \((newspaper)\)([ ]*[|}])/g, '$1|___location=Spain$3');
regex(/(''(?:ABC|Marca)) \((newspaper)\)('')/g, '$1$3 (Spain)');
regex(/(\|)(ABC|Marca)(?: \(newspaper\))(\]\])/g, '$1$2$3');
regex(/(= ?(?:Il Giorno)) \((newspaper)\)([ ]*[|}])/g, '$1|___location=Italy$3');
regex(/(''(?:Il Giorno)) \((newspaper)\)('')/g, '$1$3 (Italy)');
regex(/(\|)(Il Giorno)(?: \(newspaper\))(\]\])/g, '$1$2$3');
regex(/(= ?(?:El Universal)) \((Caracas|Cartagena|Mexico City)\)(?=[ ]*[|}])/g, '$1|___location=$2');
regex(/(''(?:El Universal)) \((Caracas|Cartagena|Mexico City)\)(?='')/g, '$1 \($2\)');
regex(/(\|El Universal)(?: \(Caracas|Cartagena|Mexico City\))(\]\])/g, '$1$2');
regex(/(= ?(?:RT)) \((TV network)\)([ ]*[|}])/g, '$1|___location=Russia$3');
regex(/(\|)(RT)(?: \(TV network\))(\]\])/g, '$1$2$3');
regex(/((?:agency|author|journal|magazine|newspaper|periodical|website|work)[ ]*=[ ]*\[\[[\w\s]+\w) ?(\|language=\w{2} ?(?:\|___location=(?=Hong Kong|Taiwan) ?|))(\]\])[ ]*(?=[|}])/g, '$1$3 $2'); //adjust misplaced brackets due to insertion
// regex(/(=[ ]*\[\[)([^\[\]\(\)\|:]*)( \([^\[\]\(\)\|]*\))(\]\])/gi, '$1$2$3|$2$4'); //adding piping to parentheticals inside parameters //disabled 7/3/2020 false positives (e.g. [[Communist Party of India (Marxist)]])
regex(/(?:author|agency|publisher)(\s*\=\s*\[\[[^()|]+ \((?:newspaper|magazine)\)\|[^\[\]|]+\]\])/gi, 'work$1');
// removing redundancies
regex(/ – (?:Times of India|Rediff.com [\w]*)(?=[ ]?\|)/gi, '');
regex(/(?: +[‒–—―] *Times Of India|)(\]. +''The Times of India''\.)indiatimes\.com/gi, '$1');
regex(/(?: +[‒–—―] *([\w ]+))(\|\s*(?:publisher|work)\s*\=\s*\1)/gi, '$2');
regex(/(\w''\.)indiatimes\.com/gi, '$1');
▲// regex(/ - [\ |w]*\ s?via\s.com[ ]*\ =\s*|/gi, '| work=');
// regex(/\|[ ]?language[ ]?\=[ ]?English[ ]*?(?=[|}])/gi, ''); //disabled removal of non-displaying language template parameter
regex(/-(.) – Google [^ \w]]*(\.com][ \.,;]*) Books\.google\.\w{2,3}(\.| )/gi, '|$1$2Google Books$3');
regex(/(.) –at Google [^ \]]*Discogs(\][\.,;]) BooksDiscogs\.google\.\w{2,3}com(\.| )/gi, '$1$2Google Books2Discogs$3');
regex(/(.\|\s*author\s?\=\s?) at Discogs(\]?:posted|publishe[\.,;dr]|written) Discogs\.coms?(\.?:by| on):?\s/gi, '$1$2Discogs$3');
regex(/(\|\s*author?(?:publisher|website|work)(\s?\=MTV)\|\s?)(?:posted|publishe[dr]|written)publisher\s?*\=\s*(?:byMTV Networks|onViacom):?\s/gi, '|publisher$1=');
regex(/\|\s?(?:publisher|website|work)(\s?\=MTV)\|\s?publisher\s*\=\s*(?:MTV Networks|Viacom)/gi, '|publisher$1=');
// regex(/\|\s?(?:publisher|website|work)\s*\=\s*(?:BBCMetacritic|BBC News(?: Online|)\[\[Metacritic\]\])\s*(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:BBC|BBC News(?:CBS OnlineInteractive|)|British\[\[CBS Broadcasting CorporationInteractive\]\])(?=[\s\.]*[|}])/g, '|workpublisher=\'\'BBC News\'\' $1$2');
// regex(/\|\s?(?:publisher|website|work)\s*\=\s*(BBC Sports?)\s*(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:BBC|BBC News(?: Online|)|British Broadcasting Corporation)(?=[\s\.]*[|}])/g, '|work=\'\'$1\'\'$2');
// regex(/\|\s?publisher\s*\=\s*(BBC (?:Sports|News))\s*(?=\|[^}<>]*|)/g, '|work=\'\'$1\'\'');
regex(/\|\s?(?:publisher|website|work)\s*\=\s*(Metacritic|\[\[Metacritic\]\])\s*(\|[^}<>]*|)\|\s?publisher\s*\=\s*(CBS Interactive|\[\[CBS Interactive\]\])(?=[\s\.]*[|}])/g, '|publisher=$1$2');
//rem duplicated publishers in separate fields (post); rem preceding nbsp
//per [[Help:Citation Style 1#Elements not included]]
// toggling domains within |website= parameter
// regex(/(\|\s*(?:work|website)\s*\=\s*)(\w+\.(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))(?=\s*[|}])/gi, '$1\'\'$2\'\'');
// reordering 'work' and 'publisher'; reordering 'work' and 'website'
regex(/(\|\s*publisher\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(\s?\|[^}<>]*|)(\|\s*(?: journal|newspaper|magazine|periodical|website|work)\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(?=[\s\.]*[|}])/g, '$3$1$2');
regex(/(\|\s*website\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(\s?\|[^}<>]*|)(\|\s*work\s*\=\s*(?:\[\[[^<{}\]]*\]\]|[^{}\|\}<>]*))(?=[\s\.]*[|}])/g, '$3$1$2');
/// removing identical/similar entries in 'work' and 'publisher', and in 'work' and 'website'
regex(/\|\s?work\s*\=\s*([^=|}\[<>]*)(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|work=$1$2'); //unlinked work
regex(/\|\s?work\s*\=\s*\[\[([^<|\]]*)\]\](\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|work=$1$2'); //unpiped work
regex(/\|\s?work\s*\=\s*(\[\[(?:[^<|\]]*)\|([^}<>]*)\]\])(\|[^}<>]*|)\|\s?publisher\s*\=\s*(\1|\2)\.?(?=\s*[|}])/g, '|work=$1$3'); //piped work
regex(/\|\s?publisher\s*\=\s*([^=|}\[<>]*)(\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unlinked work
regex(/\|\s?publisher\s*\=\s*\[\[([^<|\]]*)\]\](\|[^}<>]*|)\|\s?publisher\s*\=\s*(?:\1|\[\[\1\]\])\.?(?=\s*[|}])/g, '|publisher=$1$2'); //unpiped work
regex(/\|\s?publisher\s*\=\s*(\[\[(?:[^<|\]]*)\|([^}<>]*)\]\])(\|[^}<>]*|)\|\s?publisher\s*\=\s*(\1|\2)\.?(?=\s*[|}])/g, '|publisher=$1$3'); //piped work
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:[^=|}\[<>]*)(?:\|[^}<>]*|))\|\s?work\s*\=\s*(?:[^|}]*)(?=\s*[|}])/g, '$1'); //unlinked work
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*\[\[([^<|\]]*)\]\](?:\|[^}<>]*|))\|\s?work\s*\=\s*(?:[^|}]*)(?=\s*[|}])/g, '$1'); //linked unpiped work
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:\[\[(?:[^<|\]]*)\|(?:[^}<>]*)\]\])(?:\|[^}<>]*|))\|\s?work\s*\=\s*(?:\[\[(?:[^<|\]]*)\|(?:[^}<>]*)\]\])(?=\s*[|}])/g, '$1'); //piped work x2
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*(?:\[\[(?:[^<|\]]*)\|(?:[^}<>]*)\]\])(?:\|[^}<>]*|))\|\s?work\s*\=\s*(?:[^\[|}]*)(?=\s*[|}])/g, '$1'); //piped work x1
regex(/\|\s?___location\s*\=\s*New York(?: City|)\s*(\|[^}<>]*|)\|\s?___location\s*\=\s*(New York(?: City|)|USA)(?=[\s\.]*[|}])/g, '|___location=New York $1');
regex(/(\|[ ]*?___location=[^\|<\}]*)([^<}]*|)\|[ ]*?___location=[^|}]*(?=[|}])/gi, '$1$2');
regex(/(\|[ ]*?publisher=[^=}]*)(?:\|[ ]*?publisher=[^=}]*)(?=[|}])/gi, '$1');
// regex(/(\|[ ]*?work=[^=}]*)(?:\|[ ]*?work=[^=}]*)(?=[|}])/gi, '$1$2');
regex(/(\|[ ]*?agency=[^=}]*)([^<}]*|)(?:\|[ ]*?agency=[^=}]*)(?=[|}])/gi, '$1$2');
//remove redundant parameter ('website' is an alias of 'work')
// regex(/\|\s?(?:newspaper|website|work)\s*\=\s*([^=|}\[<>]*)(\|[^}<>]*|)\|\s?(?:newspaper|website|work)\s*\=\s*(?:\[\[[^\]]+\]\]|[|}]+)(?=\s*[|}])/g, '|work=$1$2'); //unlinked work
// regex(/\|\s?(?:newspaper|website|work)\s*\=\s*\[\[([^<|\]]*)\]\](\|[^}<>]*|)\|\s?(?:newspaper|website|work)\s*\=\s*(?:\[\[[^\]]+\]\]|[|}]+)(?=\s*[|}])/g, '|work=$1$2'); //unpiped work
// regex(/\|\s?(?:newspaper|website|work)\s*\=\s*(\[\[(?:[^<|\]]*)\|([^}<>]*)\]\])(\|[^}<>]*|)\|\s?(?:newspaper|website|work)\s*\=\s*(\1|\2)\.?(?=\s*[|}])/g, '|work=$1$3'); //piped work
regex(/(\|\s*(?:newspaper|website|work)\s*\=\s*[^=}<>]*(?:\|[^}<>]*|))\|\s?(?:newspaper|website|work)\s*\=\s*[^\}|]+(?=\s*[|}])/g, '$1'); //universal work and aliases
//unwinding of unnecessary pipes
regex(/\[\[([^\]\|]*)\|\1(?=\]\])/gi, '[[$1');
// removing artefacts (within citation templates)
regex(/(?:| (?:Daily|English|(?:Mail |)Online|Music|News|Indian Express))(?=\s*\|)+/gi, ''); //|=: Video Gaming & Real Talk - PS4, Xbox One, Switch, PC, Handheld, Retro ▼
// regex(/(\|[ ]*?author=)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,? ?)(?=[^\]\|\}]*\|)/gi, '$1'); //redundant/duplicated
▲ regex(/(?:| (?:Daily|English|(?:Mail |)Online|Music|News|Indian Express))(?=\s*\|)+/gi, ''); //|=: Video Gaming & Real Talk - PS4, Xbox One, Switch, PC, Handheld, Retro
regex(/(?:(?:[ ]+|[ ]+HighBeam Research[ ]+[-–][ ]+FREE trial[ ]+|)\|publisher=Highbeam.com)/gi, '|via=Highbeam');
regex(/( | [\w, ]*?)(?=[ ]|)/gi, '');
regex(/( | Comment is free)/gi, '');
regex(/\|\s?title\s*\=\s*BBC (?:News|Sport)\s?(?:[-–]|| )\s?/gi, '|title=');
regex(/\|\s?title\s*\=\s*Asia Times Online\s?(?:[-–]|| |:+)\s?/gi, '|title=');
regex(/(?:Entertainment|Football|(?:inter|)national|Latest|local|Music|UK|world|) News |(?=[ ]?[&\|])/gi, '');
regex(/(?:[-–|]||)[ ]*(?:Entertainment|Football|(?:inter|)national|Latest|local|Music|UK|world|) News(?=[ ]?[&\|])/gi, '');
regex(/<!-- Bot generated title -->/gi, '');
regex(/(\|\s*title\s*\=\s*[^|}]+?)[-‒–—―]\s+([^|}]+?)(\|\s*(?:publisher|work)\s*\=\s*\2)/gi, '$1$3');
regex(/(\|\s*title\s*\=\s*([^|}]+?))[-‒–—―]\s+([^|}]+?\|\s?(?:publisher|work)\s*\=\s*\2)/gi, '$1$3');
regex(/(\|\s*website\s*\=\s*Play Legit):\s+[^|}]+?(?=[\|}])/gi, '$1');
regex(/(DOC|PDF)\) \./gi, '$1).');
// removing artefacts (outside of citation templates)
regex(/([\w]+\'\')\.(?:co(?:m|m?\.\w{2})|\.\w{2})[ ]/gi, '$1. ');
// removing other artefacts
regex(/\bthe ((?:'''?|)the )/gi, '$1');
//dynamic columns for reflists; remove scroll bar ▼
// expanding/dating tags
// regex(/{{(?:cn|fact)}}/gi, '{{citation needed|date=October 2017}}');
▲ //dynamic columns for reflists; remove scroll bar
regex(/((?:[Rr]eferences|[Nn]otes)[ ]?={2,4}[\n\r])[\r\n\s]*<div (?:style|class)=[^>]*>([\S\s]*)<\/div>/g, '$1$2');
regex(/<[Rr]eferences ?\/>/g, '{{reflist}}'); //default
// regex(/({{reflist)\|30em([^}]*}})/g, '$1$2');
// regex(/({{reflist)\|\d(?:\dem|)(}})/g, '$1$2'); //default
}
regex(/(<ref name=[^/>"]*)><\/ref>/gi, '$1/>');
regex(/(<ref name=[^/>"]*)>([\s\S]*)\1>([^\{\}]*)\1>([^\{\}]*)/gi, '$1A>$2$1B>$3$1C>$4');
// regex(/(<ref name=[^/>"]*)>([\s\S]*)\1>/gi, '$1A>$2$1B>');
// regex(/(<ref name="[^/>]*)">([\s\S]*)\1>/gi, '$1A>$2$1B">');
}
//removal of all links from sources
//rem linking within citation template parameters
regex(/(\|[ ]*?(?:author|agency|publisher|journal|newspaper|periodical|via|website|work)=[ ]*?)\[\[([^\|\]]+?)\]\](?:(,? )\[\[([^\|\]]+?)\]\]|)([ ]{0,1})/gi, '$1$2$3$4$5');
regex(/(\|[ ]*?(?:author|agency|publisher|journal|newspaper|periodical|via|website|work)=[ ]*?)\[\[(?:[^\|\]]+?\|)([\w\s\,]+?)\]\](?:(,? )\[\[([^\|\]]+?)\]\]|)([ ]{0,1})/gi, '$1$2$3$4$5');
//rem other linking within refs tags
regex(/(<ref[^>]*>[^<]+?[\]\.,;]\s+)\[\[(?:[^\|\]<]*\||)([^\|\]<]*)(?: online|)\]\]([^<]*?<\/ref>)\) \./gi, '$1$2$3).');
regex(/(<ref[^>]*>[^<]+?[\]\.,;]\s+\'\')\[\[(?:[^\|\]<]*\||)([^\|\]<]*)(?: online|)\]\](\'\'[^<]*?<\/ref>)\) \./gi, '$1$2$3).');
}
var res = linkmap[n];
res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
var res = linkmap[n];
res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
var res = linkmap[n];
res = res.replace(/⍌([0-9]+)⍍/g, function(x, n) {
return linkmap[n];
});
return res;
});
return res;
});
return res;
function Ohc_Source_edit_summary(){
//Add a tag to the summary box
setoptions(minor='true');
setreason('[[User:Ohconfucius/script|Script]]-assisted fixes: per [[Help:Citation Style 1|CS1]] and [[MOS:ITALICS]]', 'append');
doaction('diff');
}
regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*(reuters)\.com\/[^<>|{}\d]*(id\w{11})[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_$3>$1"); //reuters urls with non-date serial numbers
ohc_regexregex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*([-\w]+)(?:\.[a-z]{2,3})\/[^<>|{}\d]*((?:19|20)\d\d)[-\/]((?:[0-1])\d|\w+)[-\/]((?:[0-3])\d)\/(\w+)[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_$3$4$5_$6>$1"); //urls with non-date serial numbers
// ohc_regex(/<ref>((?:[^<>]*\|\s*url\s*=|[\[\s]?)https?:\/\/(?:[^|</]+\.)*([-\w]+)(?:\.[a-z]{2,3})\/[^<>|{}\d]*@YYYY[-\/]@Mon[-\/]@DD\/(\w+)[^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@ZM@ZD_$3>$1"); //urls with non-date serial numbers
ohc_regex(/<ref>([^<>]*\|\s*url\s*=https?:\/\/(?:[^|</]+\.)*(\w+)\.(?:(?:com?|org|net|gov|ac|)(?:\.[a-z]{2}|))\/[^<>]*\|\s*date\s*=\s*@Day @Month @YYYY\s*[|}][^<>]*)(?=<\/ref>)/gi, "<ref name=$2_@Year@ZM@ZD>$1");
|