//grep.jsee - 現在開いているファイル内でのgrep検索 with(document.selection){ /***** 文字列の検索 *****/ data = new Array(); find_str=Window.prompt("検索する文字(正規表現可)を入力してください",""); StartOfDocument(); i=0; while(Find(find_str,eeFindNext+eeFindReplaceRegExp)){ SelectLine(); data[i++]=[GetActivePointY(eePosLogical),Text]; LineDown(); StartOfLine(); } /***** grep結果の出力 *****/ EndOfDocument(); NewLine(10); for (i in data) document.write(""+data[i][0]+"\t\t"+data[i][1]); } //EOF
-
実行結果はこんな感じ。(このファイル内を"S"で検索した場合)
- 5 with(document.selection){
- 8 find_str=Window.prompt("検索する文字(正規表現可)を入力してください","");
- 11 while(Find(find_str,eeFindNext+eeFindReplaceRegExp)){
- 13 data[i++]=[GetActivePointY(eePosLogical),Text];
- 15 StartOfLine();
掲示板の投稿より抜粋 St.KIKI