Forum Moderators: coopster
Assuming you have the string stored in the variable $yourtext
Good luck!
/* function pc_link_extractor($s) { $links = pc_link_extractor($listing[1]) [1][edited by: coopster at 8:49 pm (utc) on June 11, 2006]
Where $listing==
<a title="A bug in a public software release that is so embarrassing that the author notionally wears a brown paper bag over his head for a while so he won&#39;t be ..." href=http://www.example.org/jargon/html/B/brown-paper-bag-bug.html><b>brown</b>-<b>paper</b>-<b>bag</b> bug</a>
*/
$a = array() ;
if (preg_match_all('/<a\s+.*?href=[\"\']?([^\"\' >]*)[\"\']?[^>]*>(.&?)<\/a>i',
$s,$matches,PREG_SET_ORDER)) {
foreach($matches as $match) {
array_puch($a, array($match[1]m$match[2]));
}
}
return $a;
}
print_r($a) ;
[edit reason] generalized url [/edit]