「このファイルから検索(マッチする行)」の版間の差分

MSY-07 (トーク | 投稿記録)
注意書きの追加、見出しの追加
MSY-07 (トーク | 投稿記録)
→ソースコード: 省略された波括弧の追加
15行目: 15行目:
var r = new RegExp(prompt("検索", ""), "i");
var r = new RegExp(prompt("検索", ""), "i");
var s1 = "";
var s1 = "";
if (document.selection.Text == "")
if (document.selection.Text == "") {
   document.selection.SelectAll();
   document.selection.SelectAll();
}
var s1 = document.selection.Text.split("\n");
var s1 = document.selection.Text.split("\n");
var s2 = new Array();
var s2 = new Array();
for (var i = 0; i < s1.length; i++) {
for (var i = 0; i < s1.length; i++) {
   var s3 = r.exec(s1[i]);
   var s3 = r.exec(s1[i]);
   if (s3)
   if (s3) {
     s2.push(s1[i]);
     s2.push(s1[i]);
  }
}
}
document.selection.Text = s2.join("\n");
document.selection.Text = s2.join("\n");
document.selection.StartOfDocument();
document.selection.StartOfDocument();
</syntaxhighlight>
</syntaxhighlight>
スポンサーリンク