Search code examples
regexp-replace

How to put row which started with letter to row above which started with digit


Please help me with regex. This text below

07.00   Tom and Jerry
08.00   She is Just Like Others
**Series about young girl...**
09.00   Regional
09.30   Narava zdravi tržnica – Mic Mengeš, oddaja o zdravju
10.00   POP Hits
**Best music all over the world**
11.00   Alaska
12.00   Sport News
**All actual news from sports all over the world**
13.00   Morning news

must be:

07.00   Tom and Jerry
08.00   She is Just Like Others**...Series about young girl...**
09.00   Regional
09.30   Narava zdravi tržnica – Mic Mengeš, oddaja o zdravju
10.00   POP Hits**...Best music all over the world**
11.00   Alaska
12.00   Sport News**...All actual news from sports all over the world**
13.00   Morning news

Thanks


Solution

  • If you are using Notepad++, you can match the line that starts with the time like pattern. Then forget what is matched so far with \K and match the newline with \R that you want to remove.

    Match ** on the next line.

    In the replacement use **...

    ^\d{2}\.\d{2}\b.*\K\R\*\*
    

    Regex demo

    enter image description here