I have a program using a combination of JavaScript and UltraEdit scripting. The program has an array of strings to search for in a file/tab. If found, it moves the corresponding lines to a new file/tab. When using exact match it works great.
However, my source values are not exact matches. The values in the file are ######-## where the values after the dash vary. I have the value up to the dash. I attempted to build the wildcard into the array values, and I've attempted to concatenate it to the .find function with no success. Any thoughts would be greatly appreciated.
Here is the code I'm executing as a script within UltraEdit. I've truncated the array from the 50 values it contained for the purpose of demonstration.
// Start at the beginning of the file
UltraEdit.activeDocument.top();
// Search string variable used for copying of lines
//DD011881 - Building an array of values
var delString = new Array()
delString[0] = "'99999999'";
delString[1] = "'169-*'";
delString[2] = "'5482-*'";
delString[3] = "'5998-*'";
delString[4] = "'36226-*'";
delString[5] = "'215021-*'";
// Array loop value
var x = 0;
var arrayLen = delString.length
// Start with nothing on the clipboard
UltraEdit.clearClipboard();
for (x=0; x<arrayLen; x++)
{
// Establish our search string for the loop condition
var bFound = false;
while (UltraEdit.activeDocument.findReplace.find(delString[x])){
UltraEdit.activeDocument.selectLine();
UltraEdit.activeDocument.copyAppend("^c" + "\n");
bFound = true;
}
UltraEdit.activeDocument.top();
if (bFound) {
UltraEdit.document[6].paste();
UltraEdit.activeDocument.top();
UltraEdit.clearClipboard();
}
} // For Loop