Notepad++ // 如何刪除特定文字字串之間的所有內容,包括字串本身?

Notepad++ // 如何刪除特定文字字串之間的所有內容,包括字串本身?

以下範例全部在一行中,我想修復大量出現的相同類型的事情。我正在尋找刪除重複的檔案路徑。每行的第一個檔案路徑是單一檔案路徑,但之後的每個檔案路徑後面都跟著"><img src="RepeatOfThePath" class="_2yuc _3-96" />

"><img src="這只是我要刪除的和之間的部分" class="_2yuc _3-96" />(包括那些字串),但不執行命令一直到行尾,因為那是日期所在的位置(應該保留在原處)。

前:

User Two||User Two sent 8 photos. File locations: Messaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49450603_219138382307432_3277446984746663936_n_219138378974099.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49764923_358739138271625_580785213139845120_n_358739134938292.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/49764923_358739138271625_580785213139845120_n_358739134938292.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/48404864_921427388047408_7300876900581244928_n_921427381380742.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/48404864_921427388047408_7300876900581244928_n_921427381380742.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49164579_214366476179977_4468743459502555136_n_214366469513311.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/49164579_214366476179977_4468743459502555136_n_214366469513311.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49787371_2255721791336152_3381788336120135680_n_2255721784669486.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/49787371_2255721791336152_3381788336120135680_n_2255721784669486.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/48985330_811888555823956_4821470710998237184_n_811888549157290.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/48985330_811888555823956_4821470710998237184_n_811888549157290.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49658202_599404630515667_5325374562135703552_n_599404627182334.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/49658202_599404630515667_5325374562135703552_n_599404627182334.jpg" class="_2yuc _3-96" />LnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49021071_212456299699526_956147449091588096_n_212456293032860.jpg"><img src="messages/inbox/UserOne_iW_GxLYs3A/photos/49021071_212456299699526_956147449091588096_n_212456293032860.jpg" class="_2yuc _3-96" />||Dec 30, 2018, 10:29 AM

後:

User Two||User Two sent 8 photos. File locations: Messaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49450603_219138382307432_3277446984746663936_n_219138378974099.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49764923_358739138271625_580785213139845120_n_358739134938292.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/48404864_921427388047408_7300876900581244928_n_921427381380742.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49164579_214366476179977_4468743459502555136_n_214366469513311.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49787371_2255721791336152_3381788336120135680_n_2255721784669486.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/48985330_811888555823956_4821470710998237184_n_811888549157290.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49658202_599404630515667_5325374562135703552_n_599404627182334.jpgLnBrkMessaging Archive/messages/inbox/UserOne_iW_GxLYs3A/photos/49021071_212456299699526_956147449091588096_n_212456293032860.jpg||Dec 30, 2018, 10:29 AM

我該怎麼辦?

答案1

  • Ctrl+H
  • 找什麼:"><img\h+.+?class="_2yuc _3-96" />
  • 用。LEAVE EMPTY
  • 取消選取大小寫匹配
  • 檢查環繞
  • 檢查正規表示式
  • 取消選取. matches newline
  • Replace all

解釋:

"><img                  # literally
\h+                     # 1 or more horizontal spaces
.+?                     # 1 or more any character but newline
class="_2yuc _3-96" />  # literally

螢幕截圖:

在此輸入影像描述

相關內容