Initial
This commit is contained in:
30
index.js
Normal file
30
index.js
Normal 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));
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user