$text = preg_replace('/\[img\](http:\/\/w?w?w?\.?example\.com\/?.*)\[\/img\]/i', '[AME]$1[/AME]', $text);