Mailinglisten-Archive |
Hallo Henning,
mit deiner modifizierten preg_match:
function findLink($text)
{
$total = "/<a href\=\'(.*)\' target\=\'(.*)\'>(.*)<\/a>/";
if (preg_match($total,$text,$matches)) :
return $matches;
else :
die("Nothing");
endif;
}
erhälts Du die Bestandteile des Links:
$matches[0]: $text
$matches[1]: href
$matches[2]: target
$matches[3]: description
Wenn ich dich aber richtig verstanden habe willst Du aber aus :
$text = "blaaaa <a href='..........'> link</a> blaaaa"
nur "<a href='..........'> link</a>" haben??
dann sollte
function find_all_links($all_text) {
$all_total = "/\<[aA].*?[aA]\>/";
if (preg_match_all( $all_total, $all_text, $tags )) :
return $tags;
else :
die("Nothing");
endif;
}
helfen!
Gruss Stefan
php::bar PHP Wiki - Listenarchive