$re = '/^(.*?)(?=On\s+\d{2}\-\d+\-\d+|\#{2}\-.*?\-\#{2})/s';
$str = 'Second reply. #2
Met vriendelijke groet,
{sender name}
{company details}
On 25-02-15 14:38, {email name} wrote:
> [Ticket ID: 54e70396110971424425] Re: 54e70396110,678567.971424425
>
> ##- Please type your reply above this line -##
>
> Your request (54e70396110971424425) has been deemed solved. To reopen,
> please reply to this email or login on {name} to reply.
>
> ------------------------------------------------------------------------
>
> Feb 25, 14:38
>
> Dear Test user,
>
> First reply. #1
>
>
> {name}
> {company details}
>';
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