/* Converts multi-line queries with multiple INSERT statements to one query with each INSERT separated by commas. This is a common technique in MySQL; don't know about other RDBMS. Author: Yale J. Kaul Date: 20. December 2007 */ document.selection.StartOfDocument(true); var front = "insert into .* values"; // get the first part of the insert // clause, put it in clipboard buffer var re = new RegExp(front); var subj = document.GetLine(1); var part1 = re.exec(subj) if (part1.length>0) { clipboardData.setData("Text", part1); } var back =";$" var nl = "'\n"; document.selection.StartOfDocument(false); // replace all insert statements with nothing document.selection.Replace(front, "", eeReplaceAll | eeFindReplaceRegExp); // replace all semicolons at EOLs with comma document.selection.Replace(back, ",", eeReplaceAll | eeFindReplaceRegExp); //// put back the first insert document.selection.StartOfDocument(false); document.selection.Text= clipboardData.getData("Text"); // replace last comma with semicolon document.selection.EndOfDocument(false); var nf = document.selection.Find(",", eeFindPrevious); document.selection.Text = ";"; clipboardData.clearData(); document.selection.SelectAll(); document.selection.Copy(eeCopyUnicode); document.HighlightFind=false;