I have a txt file with this format:
14/12/2020 12:02:50
LOG_HERE_1 XXXXX
14/12/2020 12:04:55
LOG_HERE_2 XXXXX
14/12/2020 12:10:33
LOG_HERE_3 XXXXX
And I need to parse it, using a regexp on the dates (dd/mm/yyyy hh:mm:ss), but keeping the date on the array. For example:
Array(
[0] => '14/12/2020 12:02:50 LOG_HERE_1 XXXXX',
[1] => '14/12/2020 12:02:50 LOG_HERE_2 XXXXX',
[2] => '14/12/2020 12:02:50 LOG_HERE_3 XXXXX'
)
I tried this:
$array = preg_split('/(\d{2}\/\d{2}\/\d{4}\s\d{2}[:]\d{2}[:]\d{2})/', $data, null, PREG_SPLIT_DELIM_CAPTURE);
but it shows me:
{
0: "",
1: "14/12/2020 12:02:50",
2: "",
3: "14/12/2020 12:04:55",
4: "",
5: "14/12/2020 12:10:33",
6: ""
}