Top community members
All Wiki Articles Create Wiki Article

Welcome to Dirask IT community! ❤ 💻
We are community that shares solutions with each other.

If you think you have something to add here.

you are welcome with your fresh ideas - List Articles

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

0 contributions
12 points

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
0 contributions

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more