preg_replace /e modifier deprecated as of PHP5.4

The /e modifier was deprecated in PHP5.4 and results in warnings. Use preg_replace_callback instead. Don't use anonymous function to preserve backwards compatibility.