I have some data that looks like this:
DEC 12, 2020
incoming 192.168.0.5 10:30
outgoing 192.168.0.5 13:23
DEC 13, 2020
incoming 192.168.0.6 09:34
outgoing 192.168.0.6 14:12
I am trying to get the date and all data for that date into one grouping like so:
First match
Group 1 - DEC 12, 2020
Group 2 - incoming 192.168.0.5 10:30
outgoing 192.168.0.5 13:23
Second match
Group 1 - DEC 13, 2020
Group 2 - incoming 192.168.0.6 09:34
outgoing 192.168.0.6 14:12
I have tried this regex:
^([A-Z] \d+, \d{4})(.*)
The problem is, this reads all the way to the end instead of stopping at the next match (DEC 13, 2020) like so:
Group 1 - DEC 12, 2020
Group 2 - incoming 192.168.0.5 10:30
outgoing 192.168.0.5 13:23
DEC 13, 2020
incoming 192.168.0.6 09:34
outgoing 192.168.0.6 14:12
If I add the ? like so:
^([A-Z] \d+, \d{4})(.*?)
The I get only the dates.
First Match
Group 1 - DEC 12, 2020
Group 2 - white space
Second Match
Group 1 - DEC 13, 2020
Group 2 - white space
Can someone please tell me what I am missing? How can I get it to stop at the next match and not the end of the line or end of the text? All lines have a CRLF at the end. Thanks.