
基本的に私は次のような形式のアイテムのリストを持っています
item1:item2:item3
次のようにするには、すべての item1 を削除する必要があります。
item2:item3
私はほとんどのテキスト エディターを持っているので、どれが最も適しているか教えてください。ありがとうございます。
(追記:同じアイテムカテゴリ内のアイテムも含め、すべてのアイテムは異なり、同じものはありません)
答え1
- Ctrl+H
- 検索対象:
^.+?:(.*\R)
- と置換する:
$1
- チェック ラップアラウンド
- 正規表現をチェック
- チェックを外す
. matches newline
- Replace all
説明:
^ # beginning of line
.+? # 1 or more any character but newline, not greedy
: # a colon
(.*\R) # 0 or more any character but newline, followed by any kind of linebreak
交換:
$1 # content of group 1 (i.e. everything that is after the first colon)
与えられた条件:
item1:item2:item3
item2:item1:item3
item3:item2:item1
与えられた例の結果:
item2:item3
item1:item3
item2:item1