function autoEdLinks(str) { //MAIN FUNCTION describes list of fixes str = str.replace(/\]\ ["); //repair bad external links str = str.replace(/\\n]*?)\]\]?/gi, ""); //str = str.replace(/\]*?)\|(]*?)\]/gi, ""); return str; }