user332153
user332153

Reputation: 129

Delete Numeration Lines from Subtitle

I have this subtitle text with many many lines.
Before times and text i have numeration (1,2,3,4,5...111 numbers):

Legend:

1 = numeration
2 = numeration
00:14:xx:xx = times
quando a te... = text

text example:

1
00:14:38,511 --> 00:14:45,747
quando a te venne il Salvatore,

2
00:14:55,595 --> 00:15:06,699
...volle da te prendere il battesimo,...
ma il prete rifiuto

10
00:15:16,082 --> 00:15:27,050
e si consacrò al martirio,

213
00:15:34,467 --> 00:15:46,174
ci diede un pegno di salvezza:
ecco! ci siamo andiamo a ubriarci

i want delete numeration lines:

1
2
10
213

this should be the end result:

00:14:38,511 --> 00:14:45,747
quando a te venne il Salvatore,

00:14:55,595 --> 00:15:06,699
...volle da te prendere il battesimo,...
ma il prete rifiuto

00:15:16,082 --> 00:15:27,050
e si consacrò al martirio,

00:15:34,467 --> 00:15:46,174
ci diede un pegno di salvezza:
ecco! ci siamo andiamo a ubriarci

Upvotes: 2

Views: 299

Answers (2)

hwnd
hwnd

Reputation: 70732

You can simply just use the following:

Find: ^\d+\s+
Replace:
         ^ empty

Explanation:

^       # the beginning of the string
\d+     # digits (0-9) (1 or more times)
\s+     # whitespace (\n, \r, \t, \f, and " ") (1 or more times)

Upvotes: 1

zx81
zx81

Reputation: 41838

  • Search: (?m)^\d+$[\r\n]+

  • Replace: empty string

In engines that don't support inline modifiers such as (?m), you'll usually add the m flag at the end of the pattern, like so:

/^\d+$[\r\n]+/m

Explanation

  • (?m) turns on multi-line mode, allowing ^ and $ to match on each line
  • The ^ anchor asserts that we are at the beginning of the string
  • \d+ matches digits
  • The $ anchor asserts that we are at the end of the string
  • [\r\n]+ matches line breaks
  • We replace with the empty string

Upvotes: 1

Related Questions