2017-02-20 148 views
0

我有一個文本文檔,其中有很多網址。 URls有許多不同的結局,如.net,.com,.de等...所有的URL都沒有http:// oder www。前面。還有就是文檔中許多其他的文本,它看起來是這樣的:記事本++:如何刪除除url之外的所有內容?

2014/05/03 Red V!per  M R United States  jsugarcia.com/viper.gif Linux mirror 
2014/05/03 Red V!per  M R United States  thepeoplecenter.org/viper.gif Linux mirror 
2014/05/03 Red V!per   R Netherlands  ghijbeek.nl/viper.gif Linux mirror 
2014/05/03 Red V!per  M R Netherlands  straalbedrijfsanders.nl/viper.gif Linux mirror 
2014/05/03 Red V!per   R European Union  serialnastya.com/viper.gif Linux mirror 
2014/05/03 Red V!per  M R Denmark  thueringer-treppenlifte.de/vip... Linux mirror 
2014/05/03 Red V!per   R United States  tapitwater.com/images/viper.gif Linux mirror 
2014/05/03 Red V!per   R Norway  sekureco.no/viper.gif Linux mirror 

我想在記事本中篩選++現在讓我只有用這樣的linebrak網址:

網站。 COM

+0

什麼'均值與像this'一個linebrak? – user

回答

5

似乎所有行終止Linux mirror,如果它是永諾的情況下,你可以這樣做:

  • 按Ctrl + ^h
  • 查找內容:^.+\s+([^\s/]+)\S+\s+Linux\s+mirror
  • 替換爲:$1
  • 全部替換

說明:

^   : begining of line 
    .+  : 1 or more any character 
    \s+  : 1 or more space 
    (  : start group 1 
    [^\s/]+ : 1 or more NON space or NON slash (The domain) 
)   : end group 1 
    \S+  : 1 or more NON space 
    \s+  : 1 or more space 
    Linux  : literally Linux 
    \s+  : 1 or more space 
    mirror : literally mirror 

結果爲給定的例子:

jsugarcia.com 
thepeoplecenter.org 
ghijbeek.nl 
straalbedrijfsanders.nl 
serialnastya.com 
thueringer-treppenlifte.de 
tapitwater.com 
sekureco.no 
+0

令人驚歎,非常感謝! –

1
  1. Ctrl+F打開搜索框
  2. 選擇選項Regular Expression
  3. 將這個正則表達式在查找內容框中:.*(\b\w+\.com).*
  4. 按下按鈕Find All in Current Document

您可以測試正則表達式,你想在:https://regex101.com/r/0o2IsM/3


enter image description here

enter image description here

+0

非常感謝你的幫助<3 –

相關問題