Community
    • Login

    Multiple copy/paste notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 8.6k 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.
    • Rafał KowalskiR
      Rafał Kowalski
      last edited by Rafał Kowalski

      In notepad++ I mark Options->Preferences->Editing->Multi-Editing Settings.Now with Ctrl I can multi select and copy time (in this example) 00:02:12 and 00:03:22 and 00:04:14 but how paste them next to line above (multiple copy and paste)

      Now I have:
      1 00:01:11
      2 fdfdfdfdfdfdf
      3
      4 00:02:12
      5
      6 hjhgjjjjjjjjjjg
      7 00:03:22
      8
      9 hgffggggggg
      10
      11 00:04:14
      12 hjghhhghggg
      …

      I want to have:
      **1 00:01:11 00:02:12
      2 fdfdfdfdfdfdf
      3
      4 00:02:12 00:03:22
      5
      6 hjhgjjjjjjjjjjg
      7 00:03:22 00:04:14
      8
      9 hgffggggggg
      10
      11 00:04:14
      12 hjghhhghggg

      …**
      Maybe You have other ideas how to faster copy/paste this time (00:00:00) from line to line?

      Alan KilbornA Scott SumnerS 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Rafał Kowalski
        last edited by

        @Rafał-Kowalski said:

        Maybe You have other ideas how to faster copy/paste this time (00:00:00) from line to line

        Yep. Forget Notepad++ and write a program to do it.

        1 Reply Last reply Reply Quote 0
        • Scott SumnerS
          Scott Sumner @Rafał Kowalski
          last edited by

          @Rafał-Kowalski , @Alan-Kilborn

          A viable technique for doing this sort of thing within Notepad++ (and without a programming language) may be found in this thread: https://notepad-plus-plus.org/community/topic/13995/find-and-replace-timecode-srt

          It would need to be adapted slightly, but the hardest part is already figured out.

          1 Reply Last reply Reply Quote 0
          • guy038G
            guy038
            last edited by guy038

            Hello, @rafał-kowalski,

            My idea is to find, with a regex, a 00:00:00 time template, ONLY IF it’s followed, further on, by an other 00:00:00 time template and to store this second time template, in a group, for further use in replacement

            To that purpose, we’ll use a positive look-ahead structure ( a condition which have to be true for an overall match, but which is never part of the final regex )

            So, the regex S/R could be :

            SEARCH (?s)\d\d:\d\d:\d\d(?=.+?(\d\d:\d\d:\d\d))

            REPLACE $0 \1

            Notes :

            • The first part, (?s), is a modifier, which means that the dot special character stands for any single character ( Standard or EOL ones )

            • Then the second part, \d\d:\d\d:\d\d, is the final text to find ( a 00:00::00 time template )

            • Now, the third part,(?=.........), is the positive look-ahead feature, which have to be true

            • Finally, the fourth part, .+?(\d\d:\d\d:\d\d), is the condition to respect :

              • .+? represents the shortest, non-null, range of any character, even split on several lines

              • (\d\d:\d\d:\d\d) is the nearest following 00:00:00 time template, which is stored as group 1, due to the surrounded parentheses

            • In replacement, we re-writes, first, the whole searched string ( $0 ), followed with a space character, and ended with the group 1 ( \1 ), which represents the second time template

            REMARK :

            It is important to point out that, when evaluating the condition .+?(\d\d:\d\d:\d\d, inside the look-ahead, the character position, used by the regex engine, is, finally, NOT moved and is still located, right after the last digit of the first time template ( the final regex to look for ), even if, somehow, it had to go ahead, till the end of the second 00:00:00 time template, in order to verify the condition )

            So starting with your original text, below :

            00:01:11
            fdfdfdfdfdfdf
            
            00:02:12
            
            hjhgjjjjjjjjjjg
            00:03:22
            
            hgffggggggg
            
            00:04:14
            hjghhhghggg
            

            This S/R would produce the text, below :

            00:01:11 00:02:12
            fdfdfdfdfdfdf
            
            00:02:12 00:03:22
            
            hjhgjjjjjjjjjjg
            00:03:22 00:04:14
            
            hgffggggggg
            
            00:04:14
            hjghhhghggg
            

            Et voilà !

            Best Regards,

            guy038

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