こんな感じか if (document.selection.Text == "") document.selection.SelectAll(); var map = new Array(); map["hoge"]= "foo"; map["piyo"]= "bar"; var s1 = document.selection.Text; for (var i in map) { s1 = s1.split(i).join(map[i]); } document.selection.Text = s1;