rewrite form preg_replace to preg_replace_callback