ereg_replace for PHP 5.3 +?

…衆ロ難τιáo~ 提交于 2019-12-01 12:47:16

Use the PCRE function preg_replace instead:

preg_replace("/<!--.*-->/", "", $str);
preg_replace("/[^a-z,A-Z]/", "", $str);

POSIX ERE is (nearly) a complete subset of PCRE. So you can use (nearly) any POSIX ERE regular expression with a PREG implementation. See the Regular Expression Flavor Comparison for futher details.

This line is now raising an exception, I suspect my web host has upgrade it's PHP installation.

$vq = ereg_replace('[[:space:]]+', ' ', trim($vq));

If I just switch to preg_replace it complains about the trailing +

I was hoping for a quick fix, this was from an example I think from IBM.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!