I am having a file in which there are number of lines which i have to remove. These lines can be distinguished using regular expression and thus utilizing series of search and replace i am able to remove them.
Now i have to repeat the same task a number of times. So i am looking for a way that i don't need to go through this series of replace again & again. Is there any way to batch/script these series of replace into a single command.
I tried doing so by recording a macro, but does not seems to work.
Try the Python Script plug-in, if you're familiar with Python. If you're not familiar with Python, you will be it in no time. Doing such kinds of automation is a fingersnip with that plug-in. And if you can't get something to work, you'll find help at the support forum of that plug-in.
At least one example link about regex replacement via the plug-in.
Besides I'm using replacement macros in N++ myself. Did you try with the complex singletabbed "Find/Replace" dialog or with the simple "Replace" tab of the multitabbed find dialog, which also supports regex? The latter one works for me. I didn't try the 1st one tho.
Sample script Multiples_SR.py (see discussion) from Python Script plugin sample scripts collection does what you need.
From the explanation of the script:
This script :
"SR_List.txt"
file, of the CURRENT directory, containing a list of SEARCH/REPLACEMENT strings, ONE PER lineAny PURE BLANK line or COMMENT line, beginning with '#', of the "SR_list.txt" file, is simply IGNORED
For EACH line, in the "SR_List.txt" file, the format is
<DELIMITER><SEARCH regex><DELIMITER><REPLACE regex><DELIMITER>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With