You are here: PSPad forum > English discussion forum > Re: Multiple search/replace operations within a file

Re: Multiple search/replace operations within a file

#1 Multiple search/replace operations within a file

Posted by: kwarr | Date: 2016-12-29 16:17 | IP: IP Logged

Is there a way to automate the search/replace function within a file? I have been trying to find a way to do it in vbscript but without success.

I regularly receive files that I have to prepare in HTML, doing the same search and replace process in each file, such as:
Replace <td with <td class="XXX"
Replace <p with <p class="yyyy"
Replace </span> </span> with ""
.. and so on

Since I am making exactly the same changes each time I want to automate the process.

Just to be clear: this is multiple search and replace within a single file. I can, of course, paste the text into Word, run a macro there and then paste it back but I'm sure there is a better way.

I should be very grateful for help with this

Kip

Options: Reply | Quote | Up ^


#2 Re: Multiple search/replace operations within a file

Posted by: pspad | Date: 2016-12-29 16:30 | IP: IP Logged

You can use user convertor.
There is a template.in_ in the .\PSPad\Convert folder
Rename it to e.g. My multireplace.ini
Modify Forward and Backward name
Put list of your replace into [conversion] section, e.g.
[conversion]
<td|<td class="XXX"
<p|<p class="yyyy"
</span> </span>|""

Delete whole [Table] section (or let it be). CharTab=0 tells PSPad to don't use Char table but conversion list

When you will be done, you can run your convertor in menu Tools / User convertors
You can assign shortcut to action Run last used convertor to quickly run convertor on more files

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR