by Mofi » Mon Jun 29, 2009 5:27 am
Whenever a script uses a find or replace (regexp or normal), the (regexp) engine must be set first. Also always specify once all find/replace options. Never let your script depend on internal defaults. An internal default could change in future.
UltraEdit.ueReOn();
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.searchDown=true;
UltraEdit.activeDocument.findReplace.searchInColumn=false;
UltraEdit.activeDocument.findReplace.matchCase=true; // Not important here, but case-sensitive searches are in general faster.
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
UltraEdit.activeDocument.findReplace.regExp=true;
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.replace("%[ ^t]++^p","");
The modification in the search string results in deletion of lines containing only spaces/tabs too.