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

提供: MeryWiki
ナビゲーションに移動 検索に移動
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>

2023年10月20日 (金) 14:42時点における版

このマクロはMeryのMacrosフォルダに同梱されています。

概要

編集中の文書から検索文字列にマッチしない行を抽出します。

ソースコード

// -----------------------------------------------------------------------------
// このファイルから検索(マッチしない行)
//
// Copyright (c) Kuro. All Rights Reserved.
// www:    https://www.haijin-boys.com/
// -----------------------------------------------------------------------------

var r = new RegExp(prompt("検索", ""), "i");
var s1 = "";
if (document.selection.Text == "") {
  document.selection.SelectAll();
}
var s1 = document.selection.Text.split("\n");
var s2	= new Array();
for (var i = 0; i < s1.length; i++) {
  var s3 = r.exec(s1[i]);
  if (!s3) {
    s2.push(s1[i]);
  }
}
document.selection.Text = s2.join("\n");
document.selection.StartOfDocument();
スポンサーリンク