Why not just take the DOMDocument?
$html = "
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>";
$dom = new DOMDocument();
$dom->loadHTML($html);
$style = $dom->getElementsByTagName('style');
// get the content from first style tag
$css = $style->item(0)->nodeValue;
// clear the comments and cdata tags
$css = str_replace(array('<!--', '-->', '<![CDATA[', ']]>', '//<![CDATA[', '//]]>'), '', $css);
echo $css;