SRT 文件的问题(索引和空行)

Problem with SRT file (index and empty line)

如何更改以下 .srt 文件使其看起来像 post 末尾的文件?:

1

1

00:00:01,270  -->  00:00:04,520
<v Narrator>Now before diving into some NodeJS code,</v>
2

2

00:00:04,520  -->  00:00:06,700
let's do a high level overview

我想改成这样(不重复索引,去掉空行):

1
00:00:01,270  -->  00:00:04,520
<v Narrator>Now before diving into some NodeJS code,</v>

2
00:00:04,520  -->  00:00:06,700
let's do a high level overview

我想我可以使用 Notepad++,但如何使用?

假设 //empty line 不存在


  • Ctrl+H
  • 查找内容:\R?\d+\R+(\d+\R)\R*(.+\R.+(\R?))
  • 替换为:</code></li> <li><strong>检查</strong> <em>匹配大小写</em></li> <li><strong>检查</strong> <em>环绕</em></li> <li><strong>检查</strong> <em>正则表达式</em></li> <li><strong>取消选中</strong> <code>. matches newline
  • 全部替换

解释:

\R?         # any kind of linebreak, optional
\d+         # 1 or more digits
\R+         # any kind of linebreak
(           # group 1
    \d+         # 1 or more digits
    \R          # any kind of linebreak
)           # end group
\R*         # any kind of linebreak
(           # group 2
    .+          # 1 or more any character but newline
    \R          # any kind of linebreak
    .+          # 1 or more any character but newline
    (\R?)       # group 3, any kind of linebreak, optional
)           # end group

替换:

          # content of group 1, the digits
          # content of group 2, the text
          # content of group 3, optional linebreak

截图(之前):

截图(之后):