Home >Backend Development >PHP Tutorial >请问一个正则匹配有关问题

请问一个正则匹配有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:07:52843browse

请教一个正则匹配问题
有一段内容

<br />$neirong='aaaaaaaaaaaaaa<a href="1.html" target="_blank">啦啦啦啦</a>ddddddddddddddd';<br /><br />


请教怎么用正则匹配函数preg_replace,把这段内容中的‘啦啦啦啦’消除,只留下字符。
注:链接中‘1.html'和“啦啦啦啦”是随机出现的
------解决思路----------------------
echo preg_replace('#<a.+?</a>#s', '', $neirong);

------解决思路----------------------
    <?php  <br />	<br />    $string = 'aaaaaaaaaaaaaa<a href="1.html" target="_blank">啦啦啦啦</a>ddddddddddddddd';<br />	 <br />	echo preg_replace('/<a href="(?:.*)" target="_blank">(.*)<\/a>/Ui', '\1', $string);  <br /><br />    ?>
   

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