Ho un testo che potrebbe essere strutturato in questo modo:
"[ img]http://html.it/html.gif[/img]
Il sito dedicato
all'html."
Ora avrei bisogno di estrarre la sola immagine e cancellare i tag.
Ho provato con qualcosa del tipo:ma ovviamente non va.Codice PHP:
if (eregi("(\[img\])(.*?)(\[/img\])",$text,$regs)) {
echo "<img src=\"".$regs[2]."\" />";
$text = preg_replace("#\[(img)\](.*?)\[/(img)\]#si","",$text);
}
return $text;
}
Qualche idea?