我正在执行此javascript插件来扫描日志文件。它适用于Oracle,Sybase和UDB,但不适用于Microsoft SQL。我在行var filename = line.split(“\”)上收到错误;并且错误是未终止的字符串文字(后处理#6)我必须在Microsoft SQL脚本中为此文字指定什么
properties.put("Status", "Success");
var process = [];
var filename3;
scanner.register("(?i)Executing", function(lineNumber, line) {
var errors = properties.get("Executing");
var filename = line.split("\");
var filename2 = filename[16];
if (filename3 == null) {
filename3 = filename2;
}
else {
filename3 = filename3 + "\n" + filename2;
}
process.push(filename3);
properties.put("Processed_artifacts",filename3);
});
scanner.register("Fail", function(lineNumber, line) {
if (process.length > 1) {
process.reverse();
var element1 = process[1];
properties.put("Processed_artifacts",element1);
}
if (process.length < 2) {
var element1 = 'default.txt';
properties.put("Processed_artifacts",element1);
}
properties.put("exitCode", "1");
properties.put("Status", "Fail");
var value = line.replace("Fail ", "")
properties.put("Fail", value);
});
scanner.scan();
var errors = properties.get("Fail");
if (errors == null) {
errors = new java.util.ArrayList();
}
properties.put("Error", errors.toString());
答案 0 :(得分:0)
要获得单个反斜杠,您必须使用\\
:
var filename = line.split("\\");
请参阅http://msdn.microsoft.com/en-us/library/ie/2yfce773%28v=vs.94%29.aspx