Change preg_replace to preg_replace_callback

As of PHP 5.5, the preg e modifier is deprecated and throw errors.