![Notepad ++ で行を置き換えて一部を残す](https://rvso.com/image/1539542/Notepad%20%2B%2B%20%E3%81%A7%E8%A1%8C%E3%82%92%E7%BD%AE%E3%81%8D%E6%8F%9B%E3%81%88%E3%81%A6%E4%B8%80%E9%83%A8%E3%82%92%E6%AE%8B%E3%81%99.png)
Notepad++ を使用して、大量のコードを検索/置換したい:
たくさん持っています:
角度[]={6.2744589,5.4066987,1.4066987};
3 つの値があります。最初と 2 番目の値をすべて 0 にして、3 番目の位置の値はそのままにする必要があります :S
角度[]={6.2744589,5.4066987,1.4066987};
に
角度[]={0,0,1.4066987};
ありがとう!
答え1
答え2
- Ctrl+H
- 検索対象:
\bangles\[\]=\{\K[^,]+,[^,]+
- と置換する:
0,0
- Replace all
説明:
\b : word boundary, to be sure to match angles but not somethingangles
angles : literally angles
\[\]=\{ : literally []=, brackets have to be escaped as they have special meaning in regex
\K : Forget all we have seen until this point
[^,]+ : 1 or more any character that is not a comma, that matches also negative values
, : a comma
[^,]+ : 1 or more any character that is not a comma
- 正規表現をチェックする
- チェックしないでください
. matches newline
与えられた例の結果:
angles[]={0,0,1.4066987};