我有下面的代码来查找正则表达式%hostname
,它正确地替换了所有文本#hostname
。
我如何复制这个%Location
,#Location.
我似乎无法让复制工作超过一个变量。
谢谢
var host= "%hostname =(.*)"; // Perl regular expression to find title string
UltraEdit.activeDocument.top();
// Turn on regular expressions
UltraEdit.activeDocument.findReplace.regExp = true;
// Find it
UltraEdit.activeDocument.findReplace.find(host);
// Load it into a selection
var host2= UltraEdit.activeDocument.selection;
// Javascript function 'match' will match the regex within the javascript engine
// so we can extract the actual title via array
t = host2.match(host);
savehost = t[1];
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.matchCase=true;
UltraEdit.activeDocument.findReplace.replace("#hostname", savehost);