Gedit で正規表現を使って置換・検索したい
Ubuntu デフォルトの Gedit は正規表現を使えません。
使えないのならプラグインで拡張できるのが Gedit のイイトコですよね。
live.gnome.org - Gedit - Plugins
に Third party plugins として紹介されてる
「 Advanced Find / Replace 」をインストールしてみます。
では早速。
「編集」 -> 「設定」 -> 「プラグイン」に「 Advanced Find / Replace 」
が出ているはずなので、チェックを付けて終了です。
Ctrl + Shift + F で検索窓がでるので、
Options -> Regular expression にチェックを入れて正規表現をお楽しみください :P
使えないのならプラグインで拡張できるのが Gedit のイイトコですよね。
live.gnome.org - Gedit - Plugins
に Third party plugins として紹介されてる
「 Advanced Find / Replace 」をインストールしてみます。
Advanced Find / Replace とは・・・
Advanced find / replace plugin is supported for both gedit2.x(Gnome2) and gedit3.x(Gnome3). From now on, v2.x.x means for gedit2.x and v3.x.x is for gedit3.x.
- Find / Replace in active document
- Find / Replace in all opened documents
- Find in all files in selected directory
- Find / Replace in current selected text
- Highlight search results
- Support regular expressions
- Show results in bottom panel
- Search using plain text
- Multi-language support
- Select and find next/previous
- Find next/previous
- Multi-lines pattern is available
では早速。
# ディレクトリがなければここまでできたら Gedit を立ち上げて
mkdir -p ~/.gnome2/gedit/plugins
# http://code.google.com/p/advanced-find/downloads/list
# から使ってる Gedit にあったものをダウンロード
# 今回は Gedit 2.30.4 です。
wget http://advanced-find.googlecode.com/files/advanced_find-2.1.2.tar.gz
tar zxvf advanced_find-2.1.2.tar.gz -C ~/.gnome2/gedit/plugins
cd ~/.gnome2/gedit/plugins/advanced_find-2.1.2/
sh install.sh
# sudo 管理者パスワード聞かれるかも・・・
「編集」 -> 「設定」 -> 「プラグイン」に「 Advanced Find / Replace 」
が出ているはずなので、チェックを付けて終了です。
![]() |
プラグインを有効にする |
Ctrl + Shift + F で検索窓がでるので、
Options -> Regular expression にチェックを入れて正規表現をお楽しみください :P
![]() |
正規表現を有効にする |