Languages
[Edit]
EN

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

12 points
Created by:
Aisha
418

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
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Regex

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join