Languages
[Edit]
EN

Regex - make youtube transcript lines from 2 lines to 1 line - time + text

12 points
Created by:
Marcin
15740

Problem

How to replace youtube / yt transcript 2 lines into 1 line.
I have youtube transcript in text file and want to make it more readable.
Each youtube transcript is like:
- 1 line time
- 1 line text from the time
What I expect:

Before:

00:20
Single line text example
00:25
Next test line

After:

00:20 Single line text example
00:25 Next test line


Solution

1. Open Notepad++
2. Open find window (Ctrl + f)
3. In find window - Replace tab
4. Find what + Replace with

- Find what - this regex:

(^\d+\d+:\d+\d+$)[\r\n]+(^.+?$)

- Replace with:

$1 $2

5. Click Replace All button
6. Before and after
- Before:

00:20
Single line text example
00:25
Next test line

- After:

00:20 Single line text example
00:25 Next test line

7. NOTES:

  • Tested with Notepad++
  • Regex works fine with windows or linux end of line - EOF:
\r\n
\n
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join