$re = '/^.*?\n\n/ms';
$str = 'Subject: RE: Test mail
From: test@stackoverflow.com
To: test@test.com
Date: 22/06/2018 10:00:00
This is the body of e-mail #3.
Subject: RE: Test mail
From: test@test.com
To: test@stackoverflow.com
Date: 22/06/2018 09:55:00
This is the body of e-mail #2.
Subject: Test mail
From: test@stackoverflow.com
To: test@test.com
Date: 22/06/2018 09:50:00
This is the body of e-mail #1.';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php