1
我有HTML的以下位:正则表达式 - 得到的一切,但最后一场比赛
<p><a href="http://vimeo.com/13114334" title="Grain & Gram: Nick Sambrato, Printmaker"><img src="http://b.vimeocdn.com/ts/747/476/74747630_200.jpg" alt="Grain & Gram: Nick Sambrato, Printmaker" /></a></p>
<p>Read the full interview with Nick Sambrato, Printmaker here:<br /><br /><a href="http://grainandgram.com/nicksambrato/" target="_blank" rel="nofollow">grainandgram.com/nicksambrato/</a></p>
<p>Cast: <a href="http://vimeo.com/grainandgram" style="color: #2786c2; text-decoration: none;">Grain & Gram</a></p>
我的目标是最后一组段落标记的隔离。我正在尝试通过匹配段落标签之间的所有内容。我的希望是,我会得到三个结果,我可以操纵数据。
我尝试以下的正则表达式:
<p\b[^>]*>(.*?)<\/p>
这只是与第一组段落标记的匹配。我如何得到它与前两个相匹配?
感谢
更新: 我在想这在错误的道路。我不能总是假设在我想要的投射文本之前会有X个信息量。然而,我可以假设Cast将成为最后一段。所以修改后的问题:除了最后一段,我怎样才能匹配所有内容?换句话说,我如何匹配之前的所有内容“演员:”?
谢谢,斯科特。其实我是以错误的方式思考这个问题的。介意看看更新? – 2010-09-02 19:46:51