$re = '/^Case title: +(?<caseTitle>.*\S) *\n+Client: +(?<client>.*?\S) *\n+Origin: +(?<origin>.*?\S) *\n+Contact: +(?<contact>.*?\S) *\n+DSM: +(?<dsm>.*?) *\n+CSM: +(?<csm>.*?\S) *\n+Assigned To: +(?<assignedTo>.*?\S) *\n+Due Date: +(?<dueDate>.*?\S) *\n+Description: +(?<desc>.*?\S) *$/mi';
$str = 'Case title: Sample Test case 9
Client: 8688211
Origin: Email
Contact: testing@me.com
DSM: testContact1
CSM: testContact1
Assigned To: testing@me.com
Due Date: 06/28/2023
Description: Sample description 9
Case title: Sample Test case 9
Client: 8688211
Origin: Email
Contact: testing@me.com
DSM: testContact1
CSM: testContact1
Assigned To: testing@me.com
Due Date: 06/28/2023
Description: Sample description 9 ';
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