I'm trying to set a variable to a regular expression and then use that variable in a findReplace. I just can't get it to work, even with a simple expression. The following script should find the word "software" but it just finds the trailing 'e'.
Can someone help?
Code: Select all
// Set UE Application Objects
UltraEdit.ueReOn; // Use UltraEdit Regular Expressions
// Set search variables
//var rexCodeTypes = "% 20[1-2] "; <-- This is what I'm trying to do
var rexCodeTypes = "s*e"; // <-- This is the simple test that doesn't work
// Retrieve and store active document's index
var activeDocIndex = getActiveDocumentIndex();
// Return focus to original document
UltraEdit.document[activeDocIndex].setActive();
UltraEdit.document[activeDocIndex].top();
UltraEdit.document[activeDocIndex].findReplace.regExp = true;
UltraEdit.document[activeDocIndex].findReplace.find(rexCodeTypes);
// Functions -----------------------------------------------------------------
/* Find the tab index of the active document */
function getActiveDocumentIndex() {
var tabindex = -1; /* start value */
for (i = 0; i < UltraEdit.document.length; i++)
{
if (UltraEdit.activeDocument.path==UltraEdit.document[i].path) {
tabindex = i;
break;
}
}
return tabindex;
}
Can someone help?