Prozrachniy Prozrachniy - 1 month ago 11
Javascript Question

How to split a string log file which starts by date in square brackets

I want to split a log string into separate logs into an array, the string looks like this:

'[2016-12-01 11:24:28.622] [INFO] Scraper - Processing year 2016 [2016-12-01 11:24:28.622] [INFO] Scraper - Successfully proccessed ....'

I tried using
function, but managed only to split by
Is there a regexp to use to split by date in square brackets ?
I'm new to regexp, would much appreciate any suggestions, thanks.
The desired outcome looks like this

['[2016-12-01 11:24:28.622] [INFO] Scraper - Processing year 2016', '[2016-12-01 11:24:28.622] [INFO] Scraper - Successfully proccessed ....']




This splits your string at every [<number> (\[\d) without consuming those themselves - look-ahead ((?=...))