Home > Backend Development > PHP Tutorial > preg_replace替换a标签解决思路

preg_replace替换a标签解决思路

WBOY
Release: 2016-06-13 10:28:07
Original
1033 people have browsed it

preg_replace替换a标签
更多
怎么写正则,要求a标签样式里出现display:none就把a标签替换成空

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

PHP code
$s = 更多<a href="http://" style="line-height:27px;color:#444547;margin-right:12px;display:none">更多</a><a href="http://" style="line-height:27px;color:#444547;margin-right:12px;">更多</a>TXT;echo preg_replace('/<a>]*(?=display:none).+?/is','',$s);<div class="clear">
                 
              
              
        
            </div></a>
Copy after login
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