$re = '/(From:[^<\n\r]*<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-.]+>)\n(Sent:[\r\s](Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday),[\r\s\S]*(AM|PM))\n(To:[\s]*[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-.]+)\n(Cc:[^\r\n]*[\r\n])?(Subject:[\s]*[^\n\r]*[\n\r])/';
$str = 'asdasd
From: kunal with love <kunal.singh@sprinklr.com>
From: Kunal Singh <kunal.singh@sprinklr.com>
Sent: Wednesday, February 28, 2018 4:38 PM
To: kevinroberts192@outlook.com
Cc: Arjit Srivastava
Subject: fwd with cc and bcc
cc and bcc';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 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