从 Notepad++ 的字幕文件中删除空行和时间戳
Remove empty lines and timestamp from subtitle file in Notepad++
我想在 Notepad++ 中删除字幕文件中的空行和时间戳
我知道这个问题已经被问过,答案是这段代码:
^[\d\s\n].*\n
但是如果文本的开头是数字,那一行也会被删除。
例如,在以下行中:
1- 我们已经看到了组织代码的更好方法
2- 我们已经了解了处理文件的方法,
1
00:00:01.876 --> 00:00:02.709
<v Instructor>We can go back now</v>
2
00:00:02.709 --> 00:00:05.042
to our web server checklist.
3
00:00:06.410 --> 00:00:08.722
1- We've already seen better ways to organise our code
4
00:00:08.722 --> 00:00:11.545
into reusable pieces with modules,
5
00:00:11.545 --> 00:00:13.315
2- we've seen ways to deal with files,
6
00:00:13.315 --> 00:00:15.940
both synchronous and asynchronous,
7
00:00:15.940 --> 00:00:16.773
and buffers,
8
00:00:16.773 --> 00:00:18.325
both the built-in Node one
9
00:00:18.325 --> 00:00:20.380
and the ES6 buffers,
10
00:00:20.380 --> 00:00:22.485
and we've seen a way to deal with work
- Ctrl+H
- 查找内容:
^\R?(\d+)\R\d\d:\d\d.+\R
- 替换为:
-
- 选中环绕
- 检查正则表达式
- 取消勾选
. matches newline
- 全部替换
解释:
^ # beginning of line
\R? # any kind of linebreak, optional
(\d+) # group 1, 1 or more digits
\R # any kind of linebreak
\d\d:\d\d # 2 digit, colon, 2digit
.+ # 1 ormore any character but newline
\R # any kind of linebreak
替换:
# content of group 1, digits
- # space, dash, space
给定示例的结果:
1 - <v Instructor>We can go back now</v>
2 - to our web server checklist.
3 - 1- We've already seen better ways to organise our code
4 - into reusable pieces with modules,
5 - 2- we've seen ways to deal with files,
6 - both synchronous and asynchronous,
7 - and buffers,
8 - both the built-in Node one
9 - and the ES6 buffers,
10 - and we've seen a way to deal with work
我想在 Notepad++ 中删除字幕文件中的空行和时间戳
我知道这个问题已经被问过,答案是这段代码: ^[\d\s\n].*\n
但是如果文本的开头是数字,那一行也会被删除。
例如,在以下行中:
1- 我们已经看到了组织代码的更好方法
2- 我们已经了解了处理文件的方法,
1
00:00:01.876 --> 00:00:02.709
<v Instructor>We can go back now</v>
2
00:00:02.709 --> 00:00:05.042
to our web server checklist.
3
00:00:06.410 --> 00:00:08.722
1- We've already seen better ways to organise our code
4
00:00:08.722 --> 00:00:11.545
into reusable pieces with modules,
5
00:00:11.545 --> 00:00:13.315
2- we've seen ways to deal with files,
6
00:00:13.315 --> 00:00:15.940
both synchronous and asynchronous,
7
00:00:15.940 --> 00:00:16.773
and buffers,
8
00:00:16.773 --> 00:00:18.325
both the built-in Node one
9
00:00:18.325 --> 00:00:20.380
and the ES6 buffers,
10
00:00:20.380 --> 00:00:22.485
and we've seen a way to deal with work
- Ctrl+H
- 查找内容:
^\R?(\d+)\R\d\d:\d\d.+\R
- 替换为:
-
- 选中环绕
- 检查正则表达式
- 取消勾选
. matches newline
- 全部替换
解释:
^ # beginning of line
\R? # any kind of linebreak, optional
(\d+) # group 1, 1 or more digits
\R # any kind of linebreak
\d\d:\d\d # 2 digit, colon, 2digit
.+ # 1 ormore any character but newline
\R # any kind of linebreak
替换:
# content of group 1, digits
- # space, dash, space
给定示例的结果:
1 - <v Instructor>We can go back now</v>
2 - to our web server checklist.
3 - 1- We've already seen better ways to organise our code
4 - into reusable pieces with modules,
5 - 2- we've seen ways to deal with files,
6 - both synchronous and asynchronous,
7 - and buffers,
8 - both the built-in Node one
9 - and the ES6 buffers,
10 - and we've seen a way to deal with work