Home > Backend Development > PHP Tutorial > PHP过滤代码,正则表达式过滤掉调用种的方法

PHP过滤代码,正则表达式过滤掉调用种的方法

WBOY
Release: 2016-06-13 13:22:10
Original
911 people have browsed it

PHP过滤代码,正则表达式过滤掉调用类的方法
在PHP里面,有这样的代码
new FlashLibraryActivate( 'http://i.dell.com/images/global/banner_engine/bannerengine2.swf?xmlPath=images%2fglobal%2fbrand%2fbillboard%2fxml%2fjp%2fbanner_jajp.xml&bannerPath=images%2fglobal%2fbrand%2fbillboard%2f930%2fja%2f','930','380','#FFFFFF','8',alternateMarkup73c952c41cef4af2a31d9b7c3c34c253,'','flashID_43790a39d7b5497a81b4256bcc53730e','high','noscale','true','opaque','false','');

我想用正则过滤掉所有
new ****(******);这种形式的代码,请问怎么做?

请高人指导

------解决方案--------------------
echo preg_replace('/new[^(]+\(.*?\)/is','',$s);
------解决方案--------------------
^ 在[]里面表示非 的意思。
[^(]+ 匹配非 ( 号 1次或多次
\( 匹配括号

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template