Migrate function from ereg_* to preg_*

This function has been DEPRECATED as of PHP 5.3.0