removing deprecated preg_replace and replacing with str_replace