I am afrait it isn't things of simple find/replace, but things of programming.
Are you able to use VBScript, JScript language? If yes, use PSPad scripting ability -- <http://forum.pspad.com/read.php?2,56667,56671> PSPad freeware editor http://www.pspad.com
