Deleting All Lines In Notepad++ Except Lines With :00 :05 :10 :15: 20: 25 :30 :35 :40 :45 :50 :55 :60

匿名 (未验证) 提交于 2019-12-03 02:38:01

问题:

How do I perform the action in Notepad++ of deleting all lines except lines with different terms?

回答1:

Open the search dialogue and select the Mark tab. In the Find what field enter a search string to find the lines to be kept. The question is not really clear, should those strings be at the start of the lines or the end or anywhere in the lines. Enter either ^:(([0-5][05])|60) or ^:(([0-5][05])|60)$ or :(([0-5][05])|60) respectively. Make sure that Bookmark line and Regular expression are selected, then click Mark all. Next visit the menu => Search => Bookmark => Remove unmarked lines.

The search strings look for a colon followed by some digits. The digits can be either any of 012345 followed by any of 05 or they can be explicitly 60. Note that 65 is not required hence the simpler regular expression :[0-6][05] cannot be used.



回答2:

You can always use regex in the find-replace, something like

^[^:][^0-6][^05] 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!