Multiple copy/paste notepad++



  • 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?



  • @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.



  • @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.



  • 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


Log in to reply