0
<p>Blockbuster event so big that the excerpt will not even fit into the allotted space.</p>
<p> The post
<a rel="nofollow" href="http://example.com/event/sample-event/">Sample Event</a>
appeared first on
<a rel="nofollow" href="http://example.com">abc</a>.
</p>
$desc = preg_replace('/<p>(.*)<\/p>/i', '$1', $event->description);
$desc = substr($desc, 0, strpos($desc, 'The post'));
嘿,我试图剥离标签,只提取部分,直到'帖子'。我尝试过/<p>(.*)<\/p>/
,但这会返回说明的两个部分。为了达到最终结果,我不得不采取一个子字符串。有没有一个正则表达式来处理这个问题,所以我不需要使用substr()?正则表达式 - 我的代码不行为
[不要用正则表达式解析HTML](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – klenium