So I'm having difficulty extracting the value of the href attribute of an anchor tag. For example I want to grab:
(Including the single quotes)
From this:
<a href='http://www.example.com/somedir/somelink.html'>link</a>
I want to store this link and any other link that is in an anchor tag in an array. Th
$returnArray=array();
/* $str is a block of html code containing loads of markup, but at least 10 or more anchor tags */
$regpattern='/<a class=\'1\' href=(.*)\>/';
preg_match_all($regpattern, $str, $returnArray, PREG_SET_ORDER);
I simply can't seem to get the regular expression to work. Any help is greatly appreciated.