User:Jonesey95/AutoEd/unnamed.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Jonesey95/AutoEd/unnamed. |
var AutoEd_baseurl = 'http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Jonesey95/AutoEd/';
if (location.protocol === 'https:') {
AutoEd_baseurl = 'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Jonesey95/AutoEd/';
}
mw.loader.load(AutoEd_baseurl + 'core4.js'); //Imports the "framework" script needed to make this function
//Sets variable configuration
autoEdTag4 = "Fix empty citation, unnamed or unsupported parameter, or invalid parameter value using [[WP:AutoEd|AutoEd]]; see [[Help:CS1 errors]]"; //Tweaks edit summary
autoEdLinkName4 = "AutoEd unnamed"; //Changes the link name at the top of the page
autoEdLinkHover4 = "Run AutoEd to fix unnamed parameter"; //When user hovers over link
//Set up function
function ReplaceUnnamed(str) { //function to replace unnamed and unsupported parameters
//Remove {{Template: (Content Translator bug)
str = str.replace(/{{Templinate:/gi, '{{');
//Change to canonical template name
str = str.replace(/(\{\{)\s*web\s*cite(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*cite we(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*cite eb(\s*\|)/gi, '$1cite web$2');
//Fix language=
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)anglès\s*([\}\|])/gi, '$1$2English$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)ingl[êée]s\s*([\}\|])/gi, '$1$2English$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]\s*=\s*)en-[usgbin]+\s*([\}\|])/gi, '$1$2English$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)engelska\s*([\}\|])/gi, '$1$2English$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)espa[ñn]h*ol\s*([\}\|])/gi, '$1$2Spanish$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)francès\s*([\}\|])/gi, '$1$2French$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)castellà\s*([\}\|])/gi, '$1$2Spanish$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\s*=\s*)Français\s*([\}\|])/gi, '$1$2French$3');
//Fix mode= and other case-sensitive parameters using upper case letters
str = str.replace(/(\|\s*mode\s*=\s*)CS1\s*([\}\|])/g, '$1cs1$2');
str = str.replace(/(\|\s*mode\s*=\s*)CS2\s*([\}\|])/g, '$1cs2$2');
str = str.replace(/(\|\s*nopp\s*=\s*)Y\s*([\}\|])/g, '$1y$2');
str = str.replace(/(\|\s*)dead\-*url(\s*=\s*)Y[es]*(\s*[\}\|])/gi, '$1url-status$2dead$3'); //replace regardless of case
str = str.replace(/(\|\s*)dead\-*url(\s*=\s*)No*(\s*[\}\|])/gi, '$1url-status$2live$3'); //replace regardless of case
str = str.replace(/(\|\s*)dead\-*url(\s*=\s*)ja*(\s*[\}\|])/gi, '$1url-status$2dead$3'); //replace regardless of case
str = str.replace(/(\|\s*)dead\-*url(\s*=\s*)unfit(\s*[\}\|])/gi, '$1url-status$2unfit$3');
str = str.replace(/(\|\s*)dead\-*url(\s*=\s*)usurped(\s*[\}\|])/gi, '$1url-status$2usurped$3');
str = str.replace(/(\|\s*last-*author-*amp\s*=\s*)Y\s*([\}\|])/g, '$1y$2');
str = str.replace(/(\|\s*url-status\s*=\s*)alive(\s*[\}\|])/gi, '$1live$2'); //fix for IABot typo
//Remove |p
// str = str.replace(/\|p \|/g, '\|');
//Add url=
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*=*(http)/gi, '$1\|url=$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*url\s*)\|*(http)/gi, '$1$2=$3');
str = str.replace(/cite url\s*\|\s*web=/gi, 'cite web\| url=');
//Replace |http with |url=http in citations
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*http/g, '$1\|url=http');
//Replace |url=-http with |url=http in citations
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*url\s*=)\s*-(http)/gi, '$1$2$3');
//Add missing cite web and other failed template typos
str = str.replace(/({{)\s*(url\s*=\s*http)/gi, '$1cite web\|$2');
str = str.replace(/({{)\s*(url)\s*(http)/gi, '$1cite web\|$2\=$3');
str = str.replace(/({{)\s*(https*:\/\/)/gi, '$1cite web\|url\=$2');
str = str.replace(/({{cite web)[\/\[\\\s]*(url)/gi, '$1\|$2');
str = str.replace(/({{cite web)[\/\[\\\s]*(http)/gi, '$1\|url\=$2');
str = str.replace(/({{cite)[\/\[\\\s]*(url)/gi, '$1 web\|$2');
str = str.replace(/({{cite)[\/\[\\\s]*(http)/gi, '$1 web\|url\=$2');
//Delete extraneous Japanese word "book"
str = str.replace(/{{\s*[Cc]ite book\|\s*\u548c\u66f8/g, '{{cite book');
//Replace isbn10 followed by isbn
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*is[nb]+10\s*=\s*[\d-X]+\s*(\|\s*isbn\s*=\s*[\d-]+\s*[\}\|])/gi, '$1$2');
//Replace id=ISSN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*id\s*=\s*\{\{ISSN\|([\d-X]+)\}\}\s*/gi, '$1\|issn=$2');
//Fix param followed by hyphen or colon
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*access-*date)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*archive-*date)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*archive-*url)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*asin)[\+\:]/gi, '$1$2=');//no hyphen (asin-tld OK)
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*author\d*)[\+\-\:](\s*[a-egkn-rt-z])/gi, '$1$2=$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*date)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi)[\+\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi)[\-\s]*(\d)/gi, '$1$2=$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*edition)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*first\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*isbn\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*last\d*)[\+\-\:]([\sb-z]+)/gi, '$1$2=$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lang[uage]*\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*page\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*pages\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}li{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*pmid)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*publisher)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*title)[\+-\:](\s*[a-kn-z])/gi, '$1$2=$3');//title-link OK
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*type)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*url)[\+\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*url)\-h/gi, '$1$2=h');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*volume\d*)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*work)[\+\-\:]/gi, '$1$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*year)[\+\-\:]/gi, '$1$2=');
//Fix other common param errors
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a+c+e+d+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*aa+c+e+s+d+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a+c+e+s+-*d+s+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*accc+e+ss+-*d+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+ee+ss+-*d+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+ss+-*d+a+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s-*d+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+ss+-*d+a+t+\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+ss+\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*[a-rt-z _]+-*d+at+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*at+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*da+re\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*d+a+t+a\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Ac+e+s+-*d+at+e\s*=/g, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*d+at+ee+\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*d+att+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*d[a-z]+a+t+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+-*d+t+a*e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*accessed\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+s+e+-*d+at+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+e+sss+-*d+at+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+s+[a-z]*-*d+at+e\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ace+s+-*d+a+t+e+\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*address\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*air date\s*=/gi, '$1\|air-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*albumlink\s*=/gi, '$1\|title-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Archivedate\s*=/g, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*achive *date\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arhive *date\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archive[ oe_]+date\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archiv[ o_]*-*dat[eum]+\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archiveate\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archvi*edate\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archive[ oe_]+url\s*=/gi, '$1\|archive\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archiv[ o_]*-*url\s*=/gi, '$1\|archive\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archieurl\s*=/gi, '$1\|archive\-url=');
//comment "artist"; too many false positives from "template:cite certification"
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*artist\s*=/gi, '$1\|others=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arXiv\s*=/g, '$1\|arxiv=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*auhor\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*auhtor\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*auth[a-np-z]r\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Authors*\s*=/g, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Author(\d+)\s*=/g, '$1\|author$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*author (\d)+\s*=/gi, '$1\|author$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a+u+[a-z]+t+h+o+r+\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a+u+t+h+o+[a-z]+r+\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*author[ _]+link\s*=/gi, '$1\|author\-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Author-*link\s*=/g, '$1\|author\-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*c+a+r+o+g+r+a+p+h+y+\s*=/gi, '$1\|cartography=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*c+a+r+t+[a-np-z]+o+g+r+a+p+h+[ery]*\s*=/gi, '$1\|cartography=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*c+a+r+t+o+g+r+a+[a-oq-z]+p+h*[ery]*\s*=/gi, '$1\|cartography=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*c+a+r+t+o+g+r+a+p+h+e+r+\s*=/gi, '$1\|cartography=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*channel\s*=/gi, '$1\|network=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Chapter\s*=/g, '$1\|chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Citeseerx\s*=/g, '$1\|citeseerx=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*city\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Conference\s*=/g, '$1\|conference=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*consulted on\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dare*\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dat[a-df-z]*\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead\s*=/gi, '$1\|dead\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*deadlink\s*=/gi, '$1\|dead\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead[ a-z]+url\s*=/gi, '$1\|dead\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dtae\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dte\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*date *accessed\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*date *published\s*=/gi, '$1\|publication-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*date *retrieved\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Date\s*=/g, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*distributor\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*doi_brokendate\s*=/g, '$1\|doi-broken-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*doi_inactivedate\s*=/g, '$1\|doi-inactive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Edition\s*=/g, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Editors*\s*=/g, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Editor(\d)\s*=/g, '$1\|editor$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editoi*n\s*=/gi, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*episode link\s*=/gi, '$1\|episode-link=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*eprint=\s*\d+\.\d+\s*\|\s*/gi, '$1\|');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Format\s*=/g, '$1\|format=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*foramt\s*=/gi, '$1\|format=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fir[a-rt-z]t\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*F[ir]+[st](\d)*\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*First(\d*)\s*=/g, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fisr*t(\d)*\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*frist*\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*frist*(\d)+\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*first (\d)+\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*first\s*name\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*first[a-z]+\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ibsn\s*=/gi, '$1\|isbn=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*in\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*isnb[13]*\s*=/gi, '$1\|isbn=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*isbn10\s*=/gi, '$1\|isbn=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Issue\s*=/g, '$1\|issue=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Journal\s*=/g, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jorunal\s*=/g, '$1\|journal=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lang\s*=/gi, '$1\|language='); //lang is a valid alias now
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*l+a+n+gg+u+a+g+e+\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*loation\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*locaton\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lan*g*a*uge\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*la[ng]uage\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Language\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*languag[a-z]e\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lastl\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Last(\d*)\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*last (\d)+\s*=/gi, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*last\s*name\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*locale\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*l+o+c+a+t+i+o+nn+\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Location\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*loaction\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*locatoin\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lsat(\d*)\s*=/gi, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*msg-id\s*=/gi, '$1\|message-id=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*mailing list\s*=/gi, '$1\|mailing-list=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*maill+inglist\s*=/gi, '$1\|mailing-list=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ncid\s*=/gi, '$1\|id=NCID ');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*name-list-format\s*=/gi, '$1\|name-list-style=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Network\s*=/g, '$1\|network=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*netwrok\s*=/gi, '$1\|network=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*newgroups*\s*=/gi, '$1\|newsgroup=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ne[ws]paper\s*=/gi, '$1\|newspaper=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*news[a-z \-_]+paper\s*=/gi, '$1\|newspaper=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*news\s*=/gi, '$1\|newspaper=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*newsgroups\s*=/gi, '$1\|newsgroup=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Newspaper\s*=/g, '$1\|newspaper=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Number\s*=/g, '$1\|number=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*other\s*=/gi, '$1\|others=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pagees\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Page\s*=/g, '$1\|page=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Pages\s*=/g, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pbulisher\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[a-tv-z]blisher\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Place\s*=/g, '$1\|place=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pmcid\s*=/g, '$1\|pmc=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ps\s*=/gi, '$1\|postscript=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pub\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+h+e+r+[a-z]+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+[a-z]+b+l+i+s+h+e+r+[a-z]*\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[a-oq-z\d]+p+u+b+l+i+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+[a-z]*l+i+[a-rt-z]*h+s*e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+[a-km-z;]*i+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+i+l+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+e+h*r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+h+e+rr+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+[a-z]+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+[a-z]*h+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+[a-z]+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publis[a-gi-z]*er[a-z\d]*\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publisher[a-z\d]+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publishe\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+i+s+h+i+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+[a-hj-z]*s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+b+l+s+i+[a-z]*h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+[a-z]+u+b+l+i+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Publisher\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+l+b+i+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pulbication-place\s*=/gi, '$1\|publication-place=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p+u+[ac-z]*l+i+s+h+e+r+\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Quote\s*=/g, '$1\|quote=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Ref\s*=/g, '$1\|ref=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*retrieved\s*=/gi, '$1\|access\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*scal\s*=/gi, '$1\|scale=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ss+c+a+l+e*\s*=/gi, '$1\|scale=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Season\s*=/g, '$1\|season=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Series\s*=/g, '$1\|series=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*series link\s*=/gi, '$1\|series-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*service\s*=/gi, '$1\|agency=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Station\s*=/g, '$1\|station=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*template doc demo\s*=/g, '$1\|template-doc-demo=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+i+[a-su-z]*l+e\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+i+t+[el]\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+i+t+e+l+\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+i+t[a-z]l+e+\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+i+t[a-km-z]+e+\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*t+[a-hj-z]+t+l+e+\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Title\s*=/g, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*title[ -_]*trans\s*=/gi, '$1\|trans-title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trans *chapter\s*=/gi, '$1\|trans-chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trans_chapter\s*=/g, '$1\|trans-chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trans_title\s*=/g, '$1\|trans-title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trans *titl*e\s*=/gi, '$1\|trans-title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Type\s*=/g, '$1\|type=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ublisher\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*rl\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ulr\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ur[a-kmz\d]*\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ur[a-z\d]+l\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*urlmap\s*=/gi, '$1\|map-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*url)(status\s*=)/g, '$1-$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*u[a-qs-z]r*l\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*u[a-qs-z]r*l\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]ite(?! court)(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*vol\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]ita(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*vol\s*=/gi, '$1\|volume=');
// str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*vol\s*=/gi, '$1\|volume='); breaks cite court
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Volume\s*=/g, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*web si*te\s*=/gi, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Website\s*=/g, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*web[si]te\s*=/gi, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*webiste\s*=/gi, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*w[a-z\d]ork\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wokr\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*work[a-z]+\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wo[a-qs-z]k\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wprl\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Work\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Year\s*=/g, '$1\|year=');
//Hyphenate deprecated multiword parameters and redundant ref=harv (six params should not be fixed, per RFC reclose April 2021)
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*accessdate\s*=/gi, '$1\|access\-date=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*airdate\s*=/gi, '$1\|air\-date=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*authorlink\s*=/gi, '$1\|author\-link=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*authorlink(\d+)\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*authorlink(\d+)\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*authorlink(\d+)\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*author(\d+)link\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*author(\d+)link\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*author(\d+)link\s*=/gi, '$1\|author\-link$2=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archiveurl\s*=/gi, '$1\|archive\-url=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archivedate\s*=/gi, '$1\|archive\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*booktitle\s*=/gi, '$1\|book\-title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*chapterurl\s*=/gi, '$1\|chapter\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*conferenceurl\s*=/gi, '$1\|conference\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*displayauthors\s*=/gi, '$1\|display\-authors=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*episodelink\s*=/gi, '$1\|episode\-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*layurl\s*=/gi, '$1\|lay\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*mailinglist\s*=/gi, '$1\|mailing\-list=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*mapurl\s*=/gi, '$1\|map\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nopp\s*=/gi, '$1\|no\-pp=');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*origyear\s*=/gi, '$1\|orig\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicationdate\s*=/gi, '$1\|publication\-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*serieslink\s*=/gi, '$1\|series\-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*transcripturl\s*=/gi, '$1\|transcript\-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*Bryan \(3rd edition\)(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*DBI(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*O*DNB(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*ODLA(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*EI2(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
str = str.replace(/({{\s*EI3(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/g, '$1$2');
// Temp ref=harv bulk replacement; watch for false positives
str = str.replace(/({{\s*[a-z](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ref\s*=\s*harv\s*([\|\}])/gi, '$1$2');
//unknown language
str = str.replace(/(\{\{[Cc]it)iranj(e web)a(\s*\|)/g, '$1$2$3');
//Spanish and Italian and Portuguese and Catalan
str = str.replace(/(\{\{[Cc]it)ar*( web\s*\|)/g, '$1e$2');
str = str.replace(/(\{\{[Cc]it)a( jornal\s*\|)/g, '$1e journal\|');
str = str.replace(/(\{\{[Cc]it)ar*( li[bv]ro\s*\|)/g, '$1e book\|');
str = str.replace(/(\{\{[Cc]it)a( noticia\s*\|)/g, '$1e news\|');
str = str.replace(/(\{\{[Cc]it)a( news\s*\|)/g, '$1e news\|');
str = str.replace(/(\{\{[Cc]it)a( publicaci[óo]n\s*\|)/g, '$1e journal\|');
str = str.replace(/(\{\{[Cc]it)a( pubblicazione\s*\|)/g, '$1e journal\|');
str = str.replace(/(\{\{)[Rr]ef-llibre(\s*\|)/g, '$1cite book$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*abruf\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*acessadoem\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+essodata\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*agencia\s*=/g, '$1\|agency=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*altri\s*=/g, '$1\|others=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*annooriginale\s*=/g, '$1\|orig-year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a[ñn]+o\s*=/g, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*any\s*=/g, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*añoacceso\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellido-editor\s*=/g, '$1\|editor-last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellidos*(\d)\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellidos*\s*=/g, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archive url\s*=/g, '$1\|archive-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arquivodata\s*=/g, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arquivourl\s*=/g, '$1\|archive-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autor(\d)\s*=/g, '$1\|author$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autorlink(\d)*\s*=/g, '$1\|author-link$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autore*\s*=/g, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autore(\d)\s*=/g, '$1\|author$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cap[ií]t[ou]lo*\s*=/g, '$1\|chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cita\s*=/g, '$1\|quote=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cita[cç][aã]o\s*=/g, '$1\|quote=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*citazione\s*=/g, '$1\|quote=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*citt[àá]\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*coautor[eis]+\s*=/g, '$1\|coauthors=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cognom\s*=/g, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cognome*(\d)*\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*col·lecció\s*=/g, '$1\|series=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*consulta\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*curatore\s*=/g, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*data\s*=/g, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dataarchivio\s*=/g, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[dati\-]*acces+o\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edició\s*=/g, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edición\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edição\s*=/g, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editor[aie]\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editorial\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edizione*\s*=/g, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enlaceautor*(\d)\s*=/g, '$1\|author-link$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enlaceautor\s*=/g, '$1\|author-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enllaçautor\s*=/g, '$1\|author-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha-publicación\s*=/g, '$1\|publication-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha\s*=/g, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha+c+es+o\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fechaarchivo\s*=/g, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*formato\s*=/g, '$1\|format=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*giornale\s*=/g, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*idioma\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jornal\s*=/g, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*l[ií]ngua\d*\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*llengua\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lloc\d*\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*local\d*\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lugar-publicación\d*\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*m[êe]se*\s*=/gi, '$1\|month=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*n[uú]mero*\s*=/g, '$1\|issue=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom[br]*e(\d)\s*=/g, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom[br]*e\s*=/g, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nombre-editor\s*=/g, '$1\|editor-first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*o[bep]+ra\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*otros\s*=/g, '$1\|others=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áa]gina\s*=/g, '$1\|page=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áa]ginas\s*=/g, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áaà]gines*\s*=/g, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*peri[óo]dico\s*=/g, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*primei*ro(\d)*\s*=/g, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pub+lica[cz]i[óo]ne*\s*=/g, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicação\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicació\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicado\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*registo\s*=/g, '$1\|registration=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*rivista\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*seri[ae]*\s*=/g, '$1\|series=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sitioweb\s*=/g, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sito\s*=/g, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*suscripción\s*=/g, '$1\|subscription=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tipo*\s*=/g, '$1\|type=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tit[uo]lo\s*=/g, '$1\| title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*títol\s*=/g, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*título\s*=/g, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trabalho\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*traduttore\s*=/g, '$1\|translator=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ubicación\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[úu]ltimo(\d)*\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*urlarchivi*o\s*=/g, '$1\|archive-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*urlmorto\s*=/g, '$1\|dead-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*volumen\s*=/g, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wkautore\s*=/g, '$1\|author-link=');
//French
str = str.replace(/(\{\{)\s*Lien\s*brisé(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*Lien\s*web(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*Article(\s*\|)/gi, '$1cite journal$2');
str = str.replace(/(\{\{)\s*Ouvrage(\s*\|)/gi, '$1citation$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*auteur(\d*)\s*=/g, '$1\|author$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*série\s*=/g, '$1\|series=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*année\s*=/g, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*coauteurs*\s*=/g, '$1\|coauthors=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*consulté le\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*éditeur\s*=/g, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*en ligne le\s*=/g, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lien auteur(\d*)\s*=/g, '$1\|author-link$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lien éditeur(\d*)\s*=/g, '$1\|editor-link$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lieu\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lire en ligne\s*=/g, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*mois\s*=/g, '$1\|month=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom\s*=/g, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom(\d)\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*numéro\s*=/g, '$1\|number=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pages totales\s*=\s*\d+\s*/g, '$1');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*passage\s*=/g, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*périodique\s*=/g, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*prénom\s*=/g, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*prénom(\d)\s*=/g, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*site\s*=/g, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*langue\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*titre\s*=/g, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*titre chapitre\s*=/g, '$1\|chapter=');
//Swedish, I think
str = str.replace(/(\{\{)\s*bokref(\s*\|)/gi, '$1citation$2');
str = str.replace(/(\{\{)\s*webbref(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*tidningsref(\s*\|)/gi, '$1cite news$2');
str = str.replace(/(\{\{)\s*tidskriftsref(\s*\|)/gi, '$1cite journal$2');
str = str.replace(/(\{\{)\s*pressmeddelanderef(\s*\|)/gi, '$1cite press release$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*år\s*=/gi, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arkivurl\s*=/gi, '$1\|archive-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arkivdatum\s*=/gi, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*åtkomstdatum\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*datum\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*citat\s*=/gi, '$1\|quote=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*efternamn(\d*)\s*=/gi, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*författare\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*förnamn(\d*)\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*hämtdatum\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*libris\s*=(\d+)/gi, '$1\|id=\[\[LIBRIS\]\] $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*redaktör\s*=/gi, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*rubrik\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sid\s*=/gi, '$1\|page=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sidor\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*språk\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tidskrift\s*=/gi, '$1\|journal=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tidning\s*=/gi, '$1\|newspaper=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*titel\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*utgåva\s*=/gi, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*utgivare\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*utgivningsort\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*verk\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*volym\s*=/gi, '$1\|volume=');
//Norwegian
str = str.replace(/(\{\{)\s*kilde www(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*kilde artikkel(\s*\|)/gi, '$1cite news$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*besøksdato\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*bind\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*etternavn\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fornavn\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*hefte\s*=/gi, '$1\|issue=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publikasjon\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sider\s*=/gi, '$1\|pages=');
//Dutch, I think
str = str.replace(/(\{\{)\s*citeer web(\s*\|)/gi, '$1cite web$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*uitgever\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*bezochtdatum\s*=/gi, '$1\|access-date=');
//Finnish, I think
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Osoite\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Tekijä\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Ajankohta\s*=/gi, '$1\|date=');
//Russian
str = str.replace(/(\{\{)\s*статья(\s*\|)/gi, '$1cite journal$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*автор\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*страницы\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*страниц\s*=/gi, '$1\|pages='); //may not be a valid parameter
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*заглавие\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ответственный\s*=/gi, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*место\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*издание\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*издательство\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*год\s*=/gi, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*том\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*номер\s*=/gi, '$1\|number=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*тип\s*=/gi, '$1\|type=');
//German
str = str.replace(/(\{\{)\s*Literatur(\s*\|)/gi, '$1citation$2');
str = str.replace(/(\{\{)\s*Internetquelle(\s*\|)/gi, '$1cite web$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Autor\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Titel\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Verlag\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*hrsg\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Ort\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Jahr\s*=/gi, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Band\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Nummer\s*=/gi, '$1\|number=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Monat\s*=/gi, '$1\|month=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Seiten\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Sprache\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Online\s*=/gi, '$1\|url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Herausgeber\s*=/gi, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Übersetzer\s*=/gi, '$1\|others=Translated by ');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Sammelwerk\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Zugriff\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Kapitel\s*=/gi, '$1\|chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*Werk\s*=/gi, '$1\|work=');
//Turkish
str = str.replace(/(\{\{)\s*Haber kaynağı(\s*\|)/gi, '$1cite news$2');
str = str.replace(/(\{\{)\s*Web kaynağı(\s*\|)/gi, '$1cite web$2');
str = str.replace(/(\{\{)\s*Kitap kaynağı(\s*\|)/gi, '$1cite book$2');
str = str.replace(/(\{\{)\s*Dergi kaynağı(\s*\|)/gi, '$1cite magazine$2');
str = str.replace(/(\{\{)\s*Akademik dergi kaynağı(\s*\|)/gi, '$1cite journal$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ad\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ad(\d)\s*=/gi, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ay\s*=/gi, '$1\|month=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arşiv\-*tarihi\s*=/gi, '$1\|archive-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arşiv\-*url\s*=/gi, '$1\|archive-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*başlık\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*baskı\s*=/gi, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cilt\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dergi\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dil\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*erişimtarihi\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*eser\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*gazete\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ölüurl\s*=/gi, '$1\|dead-url=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead-url\s*=hayır/gi, '$1\|dead-url=no');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sayfa\s*=/gi, '$1\|page=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sayfalar\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sayı\s*=/gi, '$1\|issue=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*soyadı\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*soyadı(\d)\s*=/gi, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tarih\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yardımcıyazarlar\s*=/gi, '$1\|coauthors=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yayımcı\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yayıncı\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yazar\s*=/gi, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yazar2\s*=/gi, '$1\|author2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yazarbağı\s*=/gi, '$1\|author-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yer\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*yıl\s*=/gi, '$1\|date=');
//Vietnamese
str = str.replace(/(\{\{)\s*chú thích web(\s*\|)/gi, '$1cite web$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ngôn ngữ\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nhà xuất bản\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ngày truy cập\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ngày\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tiêu đề\s*=/gi, '$1\|title=');
//Thai
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*शीर्षक\s*=/gi, '$1\|title=');
//Korean
str = str.replace(/(\{\{)\s*뉴스 인용(\s*\|)/gi, '$1cite news$2');
str = str.replace(/(\{\{)\s*웹 인용(\s*\|)/gi, '$1cite web$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*성\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*저자\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*성명\s*=/gi, '$1\|author='); //? undocumented
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*이름\s*=/gi, '$1\|first='); //?
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*날짜\s*=/gi, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*제목\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*웹사이트\s*=/gi, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*뉴스\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*출판사\s*=/gi, '$1\|publisher=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*확인일자\s*=/gi, '$1\|access-date=');//? undocumented
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*확인날짜\s*=/gi, '$1\|access-date=');//?
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*쪽\s*=/gi, '$1\|page=');
//Polish
str = str.replace(/(\{\{)\s*Cytuj pismo(\s*\|)/gi, '$1cite journal$2');
str = str.replace(/(\{\{)\s*Cytuj(\s*\|)/gi, '$1citation$2');
str = str.replace(/(\{\{)\s*Cytuj książkę(\s*\|)/gi, '$1cite book$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*czasopismo\s*=/gi, '$1\|work=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*data dostępu\s*=/gi, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*imię\s*=/gi, '$1\|first=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*język\s*=/gi, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*miejsce\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nazwisko\s*=/gi, '$1\|last=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*odpowiedzialność\s*=/gi, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*opublikowany\s*=/gi, '$1\|website=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*strony\s*=/gi, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tytuł\s*=/gi, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wolumin\s*=/gi, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wydawca\s*=/gi, '$1\|publisher=');
//Czech (see https://cs.wikipedia.org/wiki/%C5%A0ablona:Citace_monografie)
str = str.replace(/(\{\{)\s*Citace\s*monografie(\s*\|)/gi, '$1cite book$2');
str = str.replace(/(\{\{)\s*Citace elektronické monografie(\s*\|)/gi, '$1cite web$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*datum[ _]přístupu*\s*=/g, '$1\|access-date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*datum[ _]vydání*\s*=/g, '$1\|date=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editoři*\s*=/g, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jazyk*\s*=/g, '$1\|language=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jméno(\d*)\s*=/g, '$1\|first$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*kapitola*\s*=/g, '$1\|chapter=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*korporace*\s*=/g, '$1\|author=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*místo*\s*=/g, '$1\|location=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*odkaz na autora\s*=/g, '$1\|author-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*odkaz na korporaci*\s*=/g, '$1\|author-link=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*počet stran*\s*=\s*\d*/g, '$1'); // # of pages
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*počet svazků*\s*=\s*\d*/g, '$1'); // # of volumes
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*příjmení(\d*)\s*=/g, '$1\|last$2=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*redaktoři*\s*=/g, '$1\|editor=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*rok*\s*=/g, '$1\|year=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*strany*\s*=/g, '$1\|pages=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*svazek*\s*=/g, '$1\|volume=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*titul*\s*=/g, '$1\|title=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*vydání*\s*=/g, '$1\|edition=');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*vydavatel*\s*=/g, '$1\|publisher=');
//"typ vydání" means "edition type", like "enlarged". Remove it.
//Replace year= (whitespace) month= or vice versa
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?1(\s*[\|\}])/gi, '$1January$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?2(\s*[\|\}])/gi, '$1February$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?3(\s*[\|\}])/gi, '$1March$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?4(\s*[\|\}])/gi, '$1April$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?5(\s*[\|\}])/gi, '$1May$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?6(\s*[\|\}])/gi, '$1June$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?7(\s*[\|\}])/gi, '$1July$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?8(\s*[\|\}])/gi, '$1August$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)0?9(\s*[\|\}])/gi, '$1September$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)10(\s*[\|\}])/gi, '$1October$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)11(\s*[\|\}])/gi, '$1November$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*)\|\s*month\s*=\s*)12(\s*[\|\}])/gi, '$1December$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*month\s*=\s*([a-z\/\-\–\— äû]+)\.*,*\s*([\}\|])/gi, '$1\| date=$3 $2 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*month\s*=\s*([a-z\/\-\–\— äû]+)\.*,*\s*\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*([\}\|])/gi, '$1\| date=$2 $3 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*(author\s*=\s*[a-z\s\-\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*([volume|issue|number|first[0-9]+|last[0-9]+]\s*=\s*[a-z0-9\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*(volume\s*=\s*[0-9\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*(issue\s*=\s*[0-9\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*(last[0-9]*\s*=\s*[a-z\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|\s*(first[0-9*]\s*=\s*[a-z\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*year\s*=\s*\[*(\d\d\d\d)\]*\s*\|([volume|issue|number|first[0-9]+|last[0-9]+]\s*=\s*[a-z0-9\s\-\–\—\.]+\s*\|\s*[volume|issue|number|first[0-9]+|last[0-9]+]\s*=\s*[a-z0-9\s\-\–\—\.]+\s*\|)\s*month\s*=\s*([a-z\/\-\–\— ä]+)\.*,*\s*\|/gi, '$1\| date=$4 $2 \| $3');
//Replace month=Month YYYY
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*month\s*=\s*([a-z\/\-\–\—\.\sä]+)\s*\[*(\d\d\d\d)\]*\s*([\}\|])/gi, '$1\| date=$2 $3 $4');
//Replace blank unsupported parameters
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*chapterurl\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*coauthors*\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*day\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead\-*url\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*description\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jour\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*laysource\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*laydate\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*layurl\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*month\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*name-list-format\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nopp\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*registration\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*subscription\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*transcripturl\s*=\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*([\}\|])/gi, '$1 $2'); //empty parameter
//Replace authorformat=scap
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[authedi]+or-*format\s*=\s*scap\s*([\}\|])/gi, '$1 $2');
//Replace invalid parameter values
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead-*url\s*=\s*404\s*([\}\|])/gi, '$1\|dead-url=yes $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead-*url\s*=\s*[no]\s*([\}\|])/gi, '$1\|dead-url=no $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead-*url\s*=\s*no[a-z]+\s*([\}\|])/gi, '$1\|dead-url=no $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dead-*url\s*=\s*yes[a-z]+\s*([\}\|])/gi, '$1\|dead-url=yes $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*last-*author-*amp\s*=\s*no*\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*last-*author-*amp\s*=\s*\"*[\da-mo-xz:;&]+\"*\s*([\}\|])/gi, '$1\|last-author-amp=y$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*no-*pp\s*=\s*[1-9]\d+\s*[pages]*\.*\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*no-*pp\s*=\s*false\s*\.*\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*no-*pp\s*=\s*0[\s<\>\-!p\'hidesautomcr\.]+([\}\|])/gi, '$1\|nopp=y $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*registration\s*=\s*no\s*([\}\|])/gi, '$1 $2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*subscription\s*=\s*no\s*([\}\|])/gi, '$1 $2');
//Replace pmc or pmid=PMC#### with pmc=####
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pm[cid]+\s*=\s*PMC(\d+)\s*([\}\|])/gi, '$1\| pmc=$2 $3');
//Replace trailing punctuation or letters
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*pm[cid]+\s*=\s*\d+)[a-z\.\,\;\)\*\/]+\s*([\}\|])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*pm[cid]+\s*=\s*)[a-z\.\,\;\)\*\/]+\s*([\}\|])/gi, '$1$2$3');
//Replace ol=OL#### with ol=####
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ol\s*=\s*OL([\da-z]+)\s*([\}\|])/gi, '$1\| ol=$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ol\s*=\s*open\s*library\s*O*L*([\da-z]+)\s*([\}\|])/gi, '$1\| ol=$2 $3');
//Fix OCLC that is really ISBN, or multiple OCLC values
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*isbn\s*=\s*)[\d-X]+\s*\|\s*oclc\s*=\s*(978[\d-]+\s*[\}\|])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*oclc\s*=\s*[\d]+)[ ,]+[ ,\d]+\s*([\}\|])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*oclc\s*=\s*[\d]+\s*)[,\.\)]\s*([\}\|])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*oclc\s*=\s*)2830+([\d]+)\s*([\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*oclc\s*=\s*(63) *[-–] *(17621)\s*([\}\|])/gi, '$1\|lccn=$2-$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*oclc\s*=\s*(\d\d\d\d)-(\d\d\d\d)\s*([\}\|])/gi, '$1\|issn=$2-$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*oclc\s*=\s*(\d\d)[-–](\d\d\d\d\d)\s*([\}\|])/gi, '$1\|lccn=$2-$3$4');
//Replace a multi-part invisible character with apostrophe
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))â(.*[\}\|])/gi, '$1\'$2');
//Replace a multi-part invisible character with en dash in pages=
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))â(.*[\}\|])/gi, '$1–$2');
//Replace invisible characters with nothing (e.g. soft hyphen)
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[]+([\da-z\:\'\"].*[\}\|])/gi, '$1$2');
//Replace invisible characters with space
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[\t ]+(.*[\}\|])/gi, '$1 $2');
//Replace invisible character with apostrophe
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[]+(.*[\}\|])/gi, '$1\'$2');
//Replace invisible character with apostrophe again
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[]+(.*[\}\|])/gi, '$1\'$2');
//Replace invisible character with ellipsis
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[
]+(.*[\}\|])/gi, '$1\.\.\.$2');
//Replace invisible character with en dash
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[]+(.*[\}\|])/gi, '$1–$2');
//Replace invisible character with quote mark
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))[]+(.*[\}\|])/gi, '$1\"$2');
//Replace line feed or tab character in parameter value
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*author[s\d]*\s*=[^\|\}]+)[\n\t]+([\-\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*format\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*journal\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*publisher\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*quote\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*title\s*=[^\|\}]+)[\n\t]+([\d\-\"\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*script-title\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*series\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*type\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*work\s*=[^\|\}]+)[\n\t]+([\(\s]*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
str = str.replace(/({{\s*NHLE(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*desc\s*=[^\|\}]+)[\n\t]+(\s*\w.+?(?=[\|\}]))/gi, '$1$2 $3');
//Replace external links where they don't belong
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*publisher\s*=\s*)https*:\/\/plus\.google\.com\/[\+\da-z\/]+\s*([\|\}])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*publisher\s*=\s*)https*:\/\/([a-z\-\d\.]+)\/*(\s*[\}\|])/gi, '$1$2$3$4');
//str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*title\s*=\s*)https*:\/\/(.*[\}\|])/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*website\s*=\s*)https*:\/\/([a-z\-\d\.]+)\/*(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*work\s*=\s*)https*:\/\/([a-z\-\d\.]+)\/*(\s*[\}\|])/gi, '$1$2$3$4');
//Replace non-printing characters
str = str.replace(//gi, '');
//Fix DOI with full URL
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)https*\:\/\/d*x*\.*doi\.org\/(10)/gi, '$1$2$3');
//Fix DOI with unnecessary prefix or suffix
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)doi\:*\s*(10)/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)\:\s*(10)/gi, '$1$2$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)\s*(10\.[\da-z\-\/\.\(\)]+[\da-z]+)[\.\,](\s*[\}\|])/gi, '$1$2$3$4');
//Delete non-DOI
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)\s*10\.1\.1\.[\d\.]+(\s*[\}\|])/gi, '$1$2$3');
//Replace backslash with slash
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)(10\.\d\d\d\d)\\/gi, '$1$2$3\/');
//Insert missing 1 at start
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)(0\.\d\d\d\d)/gi, '$1$2 1$3');
//Change %2F to slash
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*doi\s*=\s*)(10\.\d\d\d\d)%2F/gi, '$1$2 $3\/');
//Correct LCCN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)9720912(\s*[\}\|])/gi, '$1$297020912$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)6220878(\s*[\}\|])/gi, '$1$262020878$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)5914456(\s*[\}\|])/gi, '$1$259014456$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)5510911(\s*[\}\|])/gi, '$1$255010911$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)6725285(\s*[\}\|])/gi, '$1$267025285$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)5211515(\s*[\}\|])/gi, '$1$252011515$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)8095179(\s*[\}\|])/gi, '$1$280905179$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)7806371(\s*[\}\|])/gi, '$1$278106371$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)TX-5-007-748(\s*[\}\|])/gi, '$1$200503566$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)6613085(\s*[\}\|])/gi, '$1$266013085$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)7280175(\s*[\}\|])/gi, '$1$272080175$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)6318494(\s*[\}\|])/gi, '$1$263018494$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)8414873(\s*[\}\|])/gi, '$1$284014873$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)7912204(\s*[\}\|])/gi, '$1$279012204$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*lccn\s*=\s*)783834(\s*[\}\|])/gi, '$1$278003834$3');
//Correct arXiv
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*arxiv\s*=\s*)[a-z\-\.]+\/(\d\d\d\d\.\d\d\d\dv*\d*)(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*arxiv\s*=\s*)([a-z\d\.\/\-]+)\.[a-z]+(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*arxiv\s*=\s*)arxiv:\s*([a-z\d\.\/\-]+)(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*arxiv\s*=\s*)(\d\d\d\d\.\d\d\d\dv*\d*)[a-z\.\/](\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*arxiv\s*=\s*)abs\/([a-z\d\.\/\-]+)(\s*[\}\|])/gi, '$1$2$3$4');
//above, with eprint= instead of arxiv=
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*eprint\s*=\s*)[a-z\-\.]+\/(\d\d\d\d\.\d\d\d\dv*\d*)(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*eprint\s*=\s*)([a-z\d\.\/\-]+)\.[a-z]+(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*eprint\s*=\s*)arxiv:\s*([a-z\d\.\/\-]+)(\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*eprint\s*=\s*)(\d\d\d\d\.\d\d\d\dv*\d*)[a-z\.\/](\s*[\}\|])/gi, '$1$2$3$4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(\|\s*eprint\s*=\s*)abs\/([a-z\d\.\/\-]+)(\s*[\}\|])/gi, '$1$2$3$4');
//Cite arxiv remove unsupported parameters
str = str.replace(/({{\s*[cC]ite arxiv(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*access-*date\s*=\s*[\da-z\.\,\- ]+(\s*[\}\|])/gi, '$1$2');
str = str.replace(/({{\s*[cC]ite arxiv(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*bibcode\s*=\s*[\da-z\.\,\- ]+(\s*[\}\|])/gi, '$1$2');
str = str.replace(/({{\s*[cC]ite arxiv(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pages*\s*=\s*[\da-z\.\,\-– ]+(\s*[\}\|])/gi, '$1$2');
str = str.replace(/({{\s*[cC]ite arxiv(?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publisher\s*=\s*[\da-z\.\,\- ]+(\s*[\}\|])/gi, '$1$2');
//Replace Cite DOI template with Cite journal
str = str.replace(/{{\s*[cC]ite doi\|10\.2307\/(.+?(?=[\}]))/gi, '{{Cite journal|jstor=$1');
str = str.replace(/{{\s*[cC]ite doi\|(10\.\d+\/.+?(?=[\}]))/gi, '{{Cite journal|doi=$1');
str = str.replace(/{{\s*[cC]ite pmid\|(\d+?(?=[\}]))/gi, '{{Cite journal|pmid=$1');
//Delete second instance of identical page=X|pages=X
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*page\s*=\s*([\d]+)\s*\|\s*pages\s*=\s*\1(\s*[\}\|])/gi, '$1\|page=$2$3');
//Delete first instance of identical page=X-Y|pages=X-Y
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*page\s*=\s*([\d\-]+)\s*\|\s*pages\s*=\s*\1(\s*[\}\|])/gi, '$1\|pages=$2$3');
//Replace page=X|pages=Y with pages=X–Y
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*page\s*=\s*([\d]+)\s*(\|\s*pages\s*=\s*)([\d]+\s*[\}\|])/gi, '$1$3$2–$4');
//Replace page=Y|pages=X–Z with pages=X–Z
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*page\s*=\s*([\d]+)\s*(\|\s*pages\s*=\s*)([\d]+[-–][\d]+\s*[\}\|])/gi, '$1$3$2');
//Replace bad Time magazine ISSN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*0040-*718X/g, '$1issn=0040-781X');
//Comment out invalid Billboard Brasil ISSN (probably a UPC)
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*977-\s*217605400-2\s*\|*)/gi, '$1<!--$2-->');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*977-2155985400-2)/gi, '$1<!--$2-->');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*977-879605400-2)/gi, '$1<!--$2-->');
//Replace ISSN lower-case x with uppercase X
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*[=\|]\s*\d\d\d\d)[-–—= ]*(\d\d\d)x/g, '$1$2-$3X');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(ISSN\s*[=\|]\s*\d\d\d\d)[-–—= ]*(\d\d\d)x/g, '$1$2-$3X');
//Fix crazy separators
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d)[‐–—=\. ](\d\d\d[\dX])/gi, '$1$2-$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d)\&ndash\;(\d\d\d[\dX])/gi, '$1$2-$3');
//Fix crazy values
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*none\s*([\|\}])/gi, '$1issn=$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*null\s*([\|\}])/gi, '$1issn=$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*n\/a\s*([\|\}])/gi, '$1issn=$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*needed\s*([\|\}])/gi, '$1issn=$2');
//Fix punctuation or word following
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d)-*(\d\d\d[\dX])[\.\,\)]\s*([\|\}])/gi, '$1$2-$3 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*(\d\d\d\d)-*(\d\d\d[\dX])\s*\([a-z]+\)\s*([\|\}])/gi, '$1issn=$2-$3 $4');
//Fix letters before or after
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*[a-z,]+\s*(\d\d\d\d)-*(\d\d\d[\dX])\s*[\.\,\)\=]*\s*([\|\}])/gi, '$1issn=$2-$3 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*\#\s*(\d\d\d\d)-*(\d\d\d[\dX])/gi, '$1issn=$2-$3');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*(\d\d\d\d)-*(\d\d\d[\dX])\s*[a-z]+\s*([\|\}])/gi, '$1issn=$2-$3 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d-*\d\d\d[\dX])[\;\,\s]*\([-a-z]+\)\s*([\|\}])/gi, '$1$2');
//Fix extra "issn" after =
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*issn[\s-:=]+(\d\d\d\d)-*(\d\d\d[\dX])\s*\([a-z]+\)\s*([\|\}])/gi, '$1issn=$2-$3 $4');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*issn[\s-:=]+(\d\d\d\d)-*(\d\d\d[\dX])/gi, '$1issn=$2-$3');
//Fix double issn
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d-\d\d\d[\dX])[\;\,]\s+\d\d\d\d-\d\d\d[\dX]/gi, '$1$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d-\d\d\d[\dX])\s+\d\d\d\d-\d\d\d[\dX]/gi, '$1$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d-\d\d\d[\dX])\/\d\d\d\d-\d\d\d[\dX]/gi, '$1$2');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))(issn\s*=\s*\d\d\d\d-*\d\d\d[\dX])[\;\,\s]*\([-a-z]+\)\/*[\;\,\s]*\d\d\d\d-*\d\d\d[\dX]\s*\([-a-z]+\)\/*/gi, '$1$2');
//Billboard USA ISSN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*0005-*2510/gi, '$1issn=0006-2510');
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*006-*2510/gi, '$1issn=0006-2510');
//Super Play ISSN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*0966-*6199/gi, '$1issn=0966-6192');
//ISSN is actually an ISBN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*(97[89][\d-]+\s*[\|\}])/gi, '$1isbn=$2');
//Royal Asiatic Society Hong Kong Branch
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*1990-*7295/gi, '$1issn=1991-7295');
//Replace Zilmer invalid ISSN with valid ISBN
str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))issn\s*=\s*1406-*2865/gi, '$1isbn=9789949110896');
return str;
}
function autoEdFunctions4() { //Activates individual modules when "auto ed" tab is clicked
var txt = document.editform.wpTextbox1;
txt.value = ReplaceUnnamed(txt.value);
// txt.value = autoEdWhitespace(txt.value);
}