I am trying to capture this multiline log style in python, similar to that of a log parser. Here is a log sample:
> [2019-11-21T00:58:47.922Z] This is a single log line
> [2019-11-21T00:59:02.781Z] This is a multiline log This is a multiline
> log This is a multiline log This is a multiline log
> [2019-11-21T00:58:47.922Z] This is a single log line
> [2019-11-21T00:59:02.781Z] This is a multiline log This is a multiline
> log This is a multiline log This is a multiline log
Unfortunately, the newline characters are messing me up. I've tried negative lookaheads, behinds, etc. I can never capture more than a single log line. When I try to include the newlines, I end up capturing the entire log.
What python regex can I use to capture each message indiviudally?
I've tried stuff like:
regex = re.compile(r"^\[20.*Z\][\s\S]+", re.MULTILINE)
:(