EN
Regex - make youtube transcript lines from 2 lines to 1 line - time + text
12 points
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:
xxxxxxxxxx
1
00:20
2
Single line text example
3
00:25
4
Next test line
After:
xxxxxxxxxx
1
00:20 Single line text example
2
00:25 Next test line
1. Open Notepad++
2. Open find window (Ctrl + f)
3. In find window - Replace tab
4. Find what + Replace with
- Find what - this regex:
xxxxxxxxxx
1
(^\d+\d+:\d+\d+$)[\r\n]+(^.+?$)
- Replace with:
xxxxxxxxxx
1
$1 $2
5. Click Replace All button
6. Before and after
- Before:
xxxxxxxxxx
1
00:20
2
Single line text example
3
00:25
4
Next test line
- After:
xxxxxxxxxx
1
00:20 Single line text example
2
00:25 Next test line
7. NOTES:
- Tested with Notepad++
- Regex works fine with windows or linux end of line - EOF:
xxxxxxxxxx
1
\r\n
2
\n