#850: Avoid preg_replace() with PREG_REPLACE_EVAL

All credit goes to Otomatic