Hello,
When I search in files I want to perform extra Find on the results,
how can I do that?
Thanks
When I search in files I want to perform extra Find on the results,
how can I do that?
Thanks
Code: Select all
UltraEdit.activeDocument.selectLine();
var selTxt = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.key("UP ARROW"); /* unselect */
var path = "";
var lineno = 0;
/* Regex for fully qualified windows path followed by linenumber */
var re = /((?:[a-z]:\\)(?:[^\/:*?"<>|\r\n]*\\)?(?:[^\\\/:*?"<>|\r\n]*[.]\w+))[^\d]*(\d+)/im;
/* Regex for what looks like a filename followed by linenumber */
var re2 = /([^ \\\/:*?"<>|\r\n]*[.]\w+)[^\d]*(\d+)/im;
var reRes = re.exec(selTxt); /* proces with Regex */
if (reRes != undefined) { /* fully qualified path found */
path = reRes[1];
lineno = parseInt(reRes[2]);
}
else {
var reRes = re2.exec(selTxt); /* proces with Regex */
if (reRes != undefined) { /* file found */
path = reRes[1];
lineno = parseInt(reRes[2]);
}
}
/* ok a path is found - try and open the file */
if(path.length>0) {
UltraEdit.open(path);
UltraEdit.activeDocument.gotoLine(lineno,1);
}
Code: Select all
----------------------------------------
Find 'Database' in 'C:\temp\temp.txt':
C:\temp\temp.txt(682): [[Category:Database]]
Found 'Database' 1 time(s).
----------------------------------------
Code: Select all
UltraEdit.open("C:\\temp\\ASR_CV.txt");
UltraEdit.activeDocument.gotoLine(30,1);