There is no good reason to use a regex for this. Read in the HTML file as a DOM document, and extract the stylesheet references with Xpath:
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile("test.html");
$xpath = new DOMXpath($doc);
$stylesheets = $xpath->query("//link[@rel='stylesheet']/@href");
if ($stylesheets->length == 0) {
echo "nothing found!\n";
} else {
foreach ($stylesheets as $stylesheet) {
echo "found stylesheet: " . $stylesheet->nodeValue . "\n";
}
}
?>
That is, for each link element in the document (the //link part) where the rel property is stylesheet ([@rel='stylesheet']), extract the href attribute (/@href).