Home  >  Article  >  Backend Development  >  PHP正则轮换指定关键子行里的特殊字符的方法

PHP正则轮换指定关键子行里的特殊字符的方法

WBOY
WBOYOriginal
2016-06-13 10:37:55801browse

PHP正则替换指定关键子行里的特殊字符的方法?
php要想匹配
.....
 
.....此处省略诺干相同格式的行。

这一行里面关键字是providerName="System.Data.SqlClient" ,然后去除掉charset=utf8;这段,正则怎么搞的?
想得到的最后结果是



------解决方案--------------------

探讨

eregi();这个函数行吗?

------解决方案--------------------
preg_replace('/(]*providerName="System\.Data\.SqlClient"[^>]*)charset=utf8;([^>]*>)/is','$1$2',$s);
------解决方案--------------------
探讨
引用:

eregi();这个函数行吗?

eregi是被抛弃的函数。。。。不要沉迷在老版本的php中。。。。
Statement:
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