Menu

Notepad++ script for pasting same text

Help
2017-10-25
2017-10-25
  • Martin Hrebik

    Martin Hrebik - 2017-10-25

    Hello, please, can someone write a probably simple script for me?

    I'd like it to paste this text:

    <start>
    Unused <number>

    <end>

    Except these <start> and <end> markers. Whereas <number> are the first numeric letters from the previous line and I'd like it to paste a new line after that (like when I hit enter).

    The text file is full of things like this:

    648) Something
    Something, something...

    So I want to replace the line "something, something..." with text "Unused 648".
    There is always the end of bracket symbol - ) after the number and the number is between 0 - 9999.

    I dont know how to script in Python and I never needed to, I just want it to do this, because its annoying to select line, paste Unused and rewrite the number manually over a over again like 1000 times.

     
  • Sasumner

    Sasumner - 2017-10-26

    From the description I don't know that I understand what you are trying to do, but is it perhaps something that a regular expression replace operation could do more easily than a Pythonscript?

     
  • Martin Hrebik

    Martin Hrebik - 2017-10-27

    For example, I want to change this:

    1113) Line1
    Text, text, text...
    1114) Line2
    Text, text, text...
    1115) Line3
    Text, text, text...

    To this:

    1113) Line1
    Unused 1113

    1114) Line2
    Unused 1114

    1115) Line3
    Unused 1115

    So under every 1115) Line3 (the number and name isn't always same) I want to change description to Unused 1115 (without writing the number manually) + a blank new line, like when I press enter.

     
  • Sasumner

    Sasumner - 2017-10-28

    Search on this regular expression:

    ((\d+)\).+\R).+(\R)

    and Replace with this:

    \1Unused \2\3\3

    If this isn't what you want then you are expressing your need poorly?

     
  • Martin Hrebik

    Martin Hrebik - 2017-10-28

    Thank you very much :) Thats exactly what I needed!

     
  • Sasumner

    Sasumner - 2017-10-29

    Always think of the non-script solution first because it is probably easier! :-)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.