Using REGEX to removed Closed Captions from a SRT Subtitles file in Notepad++

时间:2015-10-30 23:09:34

标签: regex notepad++

I am editing a SRT Subtitles file in Notepad++ and need to remove all the "closed captions" parts (which are mainly used by the hearing disabled) eg.

354
00:03:11,108 --> 00:03:12,608
[Bang]

355
00:03:25,956 --> 00:03:27,248
They have not arrived

356
00:04:59,967 --> 00:05:02,301
[Television Plays]

357
00:03:25,956 --> 00:03:27,248
Mama.

358
00:03:27,332 --> 00:03:30,001
Mama!

359
00:04:25,641 --> 00:04:26,557
[Bang]

360    
00:04:59,967 --> 00:05:02,301
[Car Door Closes]

so in the above text, all the lines with " [.....] " would be removed, I understand this can be done with regular expressions?

1 个答案:

答案 0 :(得分:1)

Make sure the "regular expressions" option is checked.

Try replacing this regex:

^\[.*\]$

with an empty string.

enter image description here

If you want to delete the newlines too (to remove extra space/lines), do this instead:

^\[.*\]\r\n