Regular expression to split log file string according to time stamp format
Posted on 2007-07-25
Every new log entry starts with (example):
2007-07-02 19:37:48,296 herecomesthelogtext...
which is timestamp information (yyyy-mm-dd hh:mm:ss,ms), in 24hr format
After that timestamp, any number of lines, line feeds, empty lines, characters ... can appear, until the next entry.
What would be the correct (regular expression ?) syntax to parse the log string so that I get the individual log entries into an array (as well as the timestamp information) ?
Currently I use a modified log file with "@@@" as the start of each log entry, read in all of the string and then use string.split("@@@"), but apart from not being elegant, I might not be able to modify that logging system any longer in the future and have to rely on the more generic option.
Thanks in advance,