notepad++emeditor

It is possible to add numbers from 0-99 at the end of all line?


Hello i got something in format:

Marcin:Marcin
Pawel:Pawel

i want to add numbers between 0-99 at the end of line so result should be like:

Marcin:Marcin1
Marcin:Marcin2
..
Marcin:Marcin99
Pawel:Pawel1
Pawel:Pawel45
..
Pawel:Pawel99

etc.

Does there exist any command or plugin what can do it?

I tried manually but its so waste time, also i tried find it on google but no results.


Solution

  • You can run a python script within the PythonScript plugin.

    If it is not yet installed, follow this guide

    import re
    
    def insert_num(match):
        strout = ''
        maxcount = 100
        for counter in range(1, maxcount):
            strout += match.group() + str(counter)
            if counter < maxcount - 1:
                strout += "\n"
        return strout
        
    editor.rereplace(r'^.+(?<!\d)$', insert_num)
    

    Result for given example: (shortened)

    enter image description here