
つまり、次のような行があります。
text1:text2:text3
次のように作りたいです:
text1:text3
正規表現を使用してそれをどのように行うのでしょうか?
答え1
答え2
- Ctrl+H
- 検索対象:
:[^:\r\n]+(?=:)
- と置換する:
LEAVE EMPTY
- Replace all
説明:
: : a semicolon
[^:\r\n]+ : negative character class, any character that is not semicolon or linebreak
(?=:) : lookahead, make sure we have a semicolon after
- 正規表現をチェックする