Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.


skeletrooper wrote:Last question - and this I'm not sure can be done in UltraEdit. I realize what I now need is Perl or Javascript.


// Support function: remove starting and ending / as UE does not recognize these for regexp
RegExp.prototype.toUEregexp = function() { return this.toString().replace(/^\/|\/$/g, ""); };
// First ensure last line ends with CRLF
UltraEdit.activeDocument.bottom();
var ColNum = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") ColNum++;
if (ColNum>1) {
UltraEdit.activeDocument.insertLine();
}
// First go to top of document
UltraEdit.activeDocument.top();
UltraEdit.perlReOn(); /* Let's use Perl regexp syntax */
UltraEdit.activeDocument.findReplace.regExp = true;
//Find lines like:
//-70.098333 37.823333 -1956.1
//We use 2 tagged expressions grouping like this (shown with [] pairs)
//[-70.098333 37.823333 ][-1956.1]
var regexpFind = /^(.*? .*? )(.*?)$/;
// Loop and search for pattern
while ( UltraEdit.activeDocument.findReplace.find(regexpFind.toUEregexp()) ) {
// get line
var line = UltraEdit.activeDocument.selection;
// now parse into variables with perl regexp
var [, wLineStart,wNumber] = regexpFind.exec(line);
// Add 2000 to number (toFixed because of the buggy Math in javascript)
wNumber = (Number(wNumber) + 2000).toFixed(1);
// Write result back on top of the selected line:
UltraEdit.activeDocument.write(wLineStart+String(wNumber));
}
// reposition to top
UltraEdit.activeDocument.top();
