Page is a not externally linkable
brotherhood_of_LAN - 2:50 pm on Jul 3, 2011 (gmt 0)
Using regex to match HTML can get messy. Using PHP's DOM [php.net] functions might be easier. I found them a bit awkward to get to grips with but they bypass a lot of hassle in trying to parse documents.
<?php
$dom = new DOMDocument;
$dom->loadHTML($htmlstring);
// echo Links and their anchor text
echo '<pre>';
echo "Link\tAnchor\n";
foreach($dom->getElementsByTagName('a') as $link)
{
$href = $link->getAttribute('href');
$anchor = $link->nodeValue;
echo $href,"\t",$anchor,"\n";
// Do something here
}
echo '</pre>';
?>