Want to copy all from specific character to end of line of each line.
i want to copy part of lines to another document.
result: able to delete all except this.
Assuming your partial-line text to be copied always begins with
|40AND always continues to the end of the line AND there aren’t any lines WHICH DO NOT contain data to be copied, I would do this (but also seem to recall having seen some potentially worthy proposals for automatically selecting/copying multiple separate strings, which I haven’t tried yet):
Copy all text which contains your target data to a new Notepad++ tab; Move cursor to top.
Search > Replace…or
Ctrl+H); Make sure that
Backward directionare unchecked, and that
Search Modeis set to
Use these strings for
^matches start of line
.*matches 0 or more characters (in this case all characters from start of line until
(\|40.*)matches AND captures all characters from
|40to end of line
$matches end of line
\1replaces everything that was matched on each line with only that which was captured (via
(\|40.*)) on each line.
Sorry, I forgot the final step:
- Copy text and paste to the other document of your choice.
Here is a very handy Python script posted by @Scott-Sumner (thanks, Scott!), which allows you to copy all marked text, and requires installing the Python Script plugin for Notepad++. To use this method, here is what you should do instead of my first set of instructions above:
Install Python Script plugin; After installation, go to menu
Plugins > Python Script > New Scriptand type a suitable name for Scott’s script (I use
Copy all code for the script from Scott’s post to your new named script tab, and save.
Switch back to your tab containing the text to be marked and copied.
Search > Mark…or
Ctrl+M); Make sure that
Backward directionare unchecked,
Search Modeis set to
. matches newlineunchecked. Optional: Check
Wrap aroundif you don’t want or need to worry about where the cursor is when you perform the following steps.
Find what; Click on
Close dialog and run the script from menu
Plugins > Python Script > Scripts > CopyMarked(or whatever name you gave it).
thank you very much for valuable instructions… this saved me from a lot of trouble… thank you again…
very handy Python script…which allows you to copy all marked text, and requires installing the Python Script plugin
It appears that this ability might be “going native”, meaning no longer a need for a script to do it.
It isn’t accepting in to the actual codebase yet as of this writing, so if you’d like to see that feature with “inside Notepad++” support, maybe comment at that site.
For me, I’ve had that script set up for a long time, so it makes no difference to me.