[問題] 找出不包含特定字串的行?

作者: no1kk (心中在下雨)   2018-03-19 18:48:46
文件內容如下
[
[707860,"UA","Hurzuf"],
[519188,"RU","Novinki"],
[1283378,"NP","Gorkhā"],
[1270260,"IN","State of Haryāna"],
[708546,"UA","Holubynka"],
[1283710,"NP","Bāgmatī Zone"],
[529334,"RU","Mar’ina Roshcha"],
[1269750,"IN","Republic of India"],
[1283240,"NP","Kathmandu"],
[703363,"UA","Laspi"],
[3632308,"VE","Merida"],
[473537,"RU","Vinogradovo"],
[384848,"IQ","Qarah Gawl al ‘Ulyā"],
[569143,"RU","Cherkizovo"],
[713514,"UA","Alupka"],
[2878044,"DE","Lichtenrade"],
...
這是一個包含 城市id、國家、城市名稱 的 json 檔
因為我現在只想要某些特定國家的城市就好
要把不用的部分都刪掉
假設我想留下的是 US & CN
我使用 notepad++ 的搜尋取代功能 - 規則運算式
搜尋:
.+"(?<!US|CN)",.+\n
取代:
但這只會找出國家欄位是空白的行
如 [6255149,"","North America"],
無法找出國家非 US or CN 的行
請問我應該怎麼下條件呢?
感謝!!
作者: goldie (阿良)   2018-03-20 00:27:00
若寫不出反向樣板,可先標記該行,再至搜尋>書籤>移除標籤列
作者: no1kk (心中在下雨)   2018-03-20 11:28:00
不是我不願意這樣做,而是資料一共有20多萬筆....
作者: goldie (阿良)   2018-03-21 23:21:00
Ok...了解
作者: asglay (收收收尾)   2018-05-05 10:07:00

Links booklink

Contact Us: admin [ a t ] ucptt.com