0

I recently inherited some code with a regex expression that's part of a JSON k/v pair that I believe checks for the string "ERROR" in a log file between 10am to 7pm and excluding both 4pm to 4:29 and 4:40 to 5pm

[ 
  { 
    "log": "/working/dir/${instance}/log/log.log",
    "alerts": [
      {
        "severity": "critical",
        "string": "(1([0-5,7-9]:|6:(?!3))||[0,2]\d:)\d\d:\d\d.*?ERROR"
       }
     ]
   }
]

However, when try to validate this JSON, I get a "bad string" error due to an invalid escape.

Here's the error message from the JSON validator:

Error: Parse error on line 7:
...
    "string": "(1([0-5,7-9]:|6:(?!
  ----------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

I am not quite sure what could be wrong here. If someone could assist, it'd be greatly appreciated.

Thanks

gosaultech
  • 89
  • 1
  • 8

0 Answers0