Zaggs
1
Hi Guys!
I need to extract the anchor href content using preg_match_all.
Does anyone have a link to regex that will do this for me?
Example content:
<a class="class-name here" title="test title" target="_blank" rel="nofollow" onclick="javascript({function_here()})" href="http://sub.test.com/">
rpkamp
2
$text='<p>Hello <a class="bla" href="test.php">Test test</a> this is some <a href="bla.html">bla bla</a>, etc, etc</p>';
preg_match_all('~<a(.*?)href="([^"]+)"(.*?)>~', $text, $matches);
var_dump($matches[2]);
/*
array
0 => string 'test.php' (length=8)
1 => string 'bla.html' (length=8)
*/
