OutputBar.Clear(); OutputBar.writeln("EmEdit ver. " + editor.Version); OutputBar.Visible = true; OutputBar.SetFocus(); function trim(text) { return (text || "").replace(/^\s+|\s+$/g, ""); } function work(str) { arr0 = str.split(">"); ret = arr0[0] + '>'; // <p id="P7"> arr1 = arr0[1].split(";"); for (i = 0; i < arr1.length; i++) { //OutputBar.writeln (trim(arr1[i])); arr2 = trim(arr1[i]).split(","); //OutputBar.writeln(arr2); arrLength = arr2.length; if (arrLength == 3) { ret = ret + trim(arr2[1]) + ' ' + trim(arr2[2]) + ' ' + trim(arr2[0]) + ', '; } else if (arrLength == 2) { ret = ret + trim(arr2[1]) + ' ' + trim(arr2[0]) + ', '; } } return trim(ret); } while (document.selection.Find("<p id=\"P7\">.+;.+;.+;", eeFindNext | eeFindReplaceRegExp, eeExFindRegexBoost)) { OutputBar.writeln(document.selection.Text); out = work(document.selection.Text); OutputBar.writeln(out + '\n'); document.selection.Text = out; } |