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};