Replacing deprecated preg modifier

The /e modifier in preg_match is deprecated for security reasons. This patch replaces it with an equivalent use of preg_replace_callback.