$text = preg_replace('#\[yourtag\]http://([A-Za-z/.]+)\.(jpg|gif|png)\[/yourtag\]#si', '<img src="http://$1.$2" alt="" />', $text);