M modifier
The anchor patterns ^ and $ match the beginning and end of an entire string by default.
$text = "name: Joe\noccupation: coder\n\n";
if ( preg_match_all( "/^\w+:\s+(.*)$/m", $text, $array ) ) {
print "\n";
print_r( $array );
print "
\n";
}
?>