Home >Backend Development >PHP Tutorial >PHP正则表达式替换<>及中间内容失败

PHP正则表达式替换<>及中间内容失败

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:29:161178browse

<code>2015-7-24                                         <a href="admin/news/1566.htm" title="标题:2015年转专业终审通过学生名单公告
点击率:2692" target="_blank" class="newslist_time">2015年转专业终审通过学生名单公告</a></code>

上面是需要处理的内容,用语句preg_replace('/<.>/', '', $content);</.>为什么不能将及中间内容删除?

回复内容:

<code>2015-7-24                                         <a href="admin/news/1566.htm" title="标题:2015年转专业终审通过学生名单公告
点击率:2692" target="_blank" class="newslist_time">2015年转专业终审通过学生名单公告</a></code>

上面是需要处理的内容,用语句preg_replace('/<.>/', '', $content);</.>为什么不能将及中间内容删除?

自己找到了,好象是因为有换行.匹配不了\n,先用\s\s+把空白格去掉,再用上面的语句就可以了

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