Replaced deprecated preg_replace usage