codice:
echo preg_replace('#[img](.*?)[/img]#', '[IMG]$1[/IMG]', $text);