This commit is contained in:
Tretter
2019-01-02 13:17:56 -06:00
commit b260fb14ce
5 changed files with 349 additions and 0 deletions

30
index.js Normal file
View File

@@ -0,0 +1,30 @@
const http = require('http')
const readline=require('readline');
const rl = readline.createInterface({
input:process.stdin,
output:process.stdout,
terminal:false
});
const reTest= (regex,data)=>{
let match = regex.match(new RegExp('^/(.*?)/([giumy]*)$'));
regex = new RegExp(match[1], match[2]);
return regex.test(data);
}
// SourceTag
// ProcessingType
//let example='{ "sourceTag":"rpslog", "processingType":"casrpslog", "data":{"LogText":"Error"}}'
console.log(example);
rl.on('line', line=>{
let inputLine;
try {
inputLine = JSON.parse(line);
} catch (ex) {
console.error("Input not in JSON format:" + line);
}
console.log("line: " + reTest("/error/i",line));
})