functionescapeRegExp(string){returnstring.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');// $& means the whole matched string}firstChar=title.charAt(0);// Get first character of titlelcFirstChar=firstChar.toLowerCase();// Lowercase first character of titlerestOfTitle=escapeRegExp(title.slice(1));// Rest of titletitleRegexpString='['+escapeRegExp(firstChar)+escapeRegExp(lcFirstChar)+']'+restOfTitle;// Build regexp for title with case-insensitive first lettertitleRegexpString=titleRegexpString.replace(/ /,"[ _]")// Match spaces and underscoresoldText=oldText.replace(newRegExp('\\[\\[ *('+titleRegexpString+') *\\]\\]','g'),'$1')// Matches [[title]]oldText=oldText.replace(newRegExp('\\[\\[ *(?:'+titleRegexpString+') *\\| *([^\\|\\[\n]+?)\\]\\]','g'),'$1')// Matches [[title|piped link]]oldText=oldText.replace(newRegExp('\\[\\[ *(?:'+titleRegexpString+')#([^\\|\\[\n]+?) *\\]\\]','g'),'{{Section link||$1}}')// Matches [[Title#section]]oldText=oldText.replace(newRegExp('\\[\\[ *#([^\\|]+?) *\\]\\]','g'),'{{Section link||$1}}')// Matches [[#section]]summ="Removed [[Help:Self link|link(s) to title]] ([[Wikipedia:WikiProject Check Wikipedia/List of errors#48|CW Error #48]]) (via [[de:Benutzer:Schnark/js/bandersnatch|Bandersnatch]])"return{text:oldText,summary:summ,minor:true,bot:true};
functionescapeRegExp(string){returnstring.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');// $& means the whole matched string}firstChar=title.charAt(0);// Get first character of titlelcFirstChar=firstChar.toLowerCase();// Lowercase first character of titlerestOfTitle=escapeRegExp(title.slice(1));// Rest of titletitleRegexpString='['+escapeRegExp(firstChar)+escapeRegExp(lcFirstChar)+']'+restOfTitle;// Build regexp for title with case-insensitive first lettertitleRegexpString=titleRegexpString.replace(/ /,"[ _]")// Match spaces and underscoresoldText=oldText.replace(newRegExp('\\[\\[ *('+titleRegexpString+') *\\]\\]','g'),'$1')// Matches [[title]]oldText=oldText.replace(newRegExp('\\[\\[ *(?:'+titleRegexpString+') *\\| *([^\\|\\[\n]+?)\\]\\]','g'),'$1')// Matches [[title|piped link]]oldText=oldText.replace(newRegExp('\\[\\[ *(?:'+titleRegexpString+')#([^\\|\\[\n]+?) *\\]\\]','g'),'{{Section link||$1}}')// Matches [[Title#section]]oldText=oldText.replace(newRegExp('\\[\\[ *#([^\\|]+?) *\\]\\]','g'),'{{Section link||$1}}')// Matches [[#section]]summ="Removed [[Help:Self link|link(s) to title]] ([[Wikipedia:WikiProject Check Wikipedia/List of errors#48|CW Error #48]]) (via [[de:Benutzer:Schnark/js/bandersnatch|Bandersnatch]])"return{text:oldText,summary:summ,minor:true,bot:true};