• Login
Community
  • Login

How format srt file error

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 324 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    JS Developer
    last edited by Sep 4, 2021, 10:50 AM

    This is my srt file:
    ERROR1.PNG

    How to change it like this:
    ERROR2.PNG

    A 1 Reply Last reply Sep 4, 2021, 12:21 PM Reply Quote 0
    • A
      astrosofista @JS Developer
      last edited by Sep 4, 2021, 12:21 PM

      @JS-Developer

      Given the example data and assuming a Windows formatted document, the following regex should work:

      Search:		(?s)^(\d+)\R+?(\1)\R*?(?=\d+:\d+:\d+,\d+)
      Replace:	\r\n$1\r\n
      

      Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace All.

      Hope this helps.

      1 Reply Last reply Reply Quote 3
      • J
        JS Developer
        last edited by Sep 4, 2021, 2:09 PM

        @astrosofista
        This is amazing!! A great solution.
        I spent a long time looking for a solution. Thank you very much!

        A 1 Reply Last reply Sep 4, 2021, 3:38 PM Reply Quote 1
        • A
          astrosofista @JS Developer
          last edited by Sep 4, 2021, 3:38 PM

          @JS-Developer

          Glad the provided regex worked for you. If you frequently run into this kind of issues, I would suggest you to read the regex guide in the FAQ section of this forum and start learning how to develop your own solutions. It could be hard but rewarding.

          1 Reply Last reply Reply Quote 0
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors