删除记事本++中包含数字和/或符号的行

问题描述 投票:0回答:1

我想删除所有包含数字和/或符号的行,例如:

1
00:00:00,000 --> 00:00:04,080
random text 1

2
00:00:04,080 --> 00:00:04,920
random text 2

3
00:00:07,480 --> 00:00:08,800
random text 3

我确实尝试使用正则表达式使用

^\s*([0-9 00*]+\s*)+$
,但它只删除了第1、5和9行。结果是

00:00:00,000 --> 00:00:04,080
random text1

00:00:04,080 --> 00:00:04,920
random text2

00:00:07,480 --> 00:00:08,800
random text3

应该是

random text 1

random text 2

random text 3

这可以在notepad++中完成吗?预先感谢

regex notepad++
1个回答
0
投票

假设您想完全删除仅包含整数或 2 个时间值的整行,您可以尝试使用此模式:

Find:   ^(?:\d+|\d{2}(?::\d{2}){2},\d{3} --> \d{2}(?::\d{2}){2},\d{3})$\R
Replace: (empty)

演示

© www.soinside.com 2019 - 2024. All rights reserved.