EN
Regex - make youtube transcript lines from 2 lines to 1 line - time + text
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