Regular Expression - Getting Everything But Last Match

stephenwilliams

New Member
I have the following bit of HTML:\[code\]<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>\[/code\]My goal is to isolate the last set of paragraph tags. I'm trying this by match everything between the paragraph tags. My hope was that I'd get three results and I could manipulate the data.I tried the following regular expression:\[code\]<p\b[^>]*>(.*?)<\/p>\[/code\]It's only matching with the first set of paragraph tags. How do I get it to match with the first two?ThanksUpdate:I was thinking about this in the wrong way. I can't always assume that there will be X amount of information before the Cast text that I want. I can assume that Cast will be the last paragraph pulled, however. So the revised question: How can I match with everything EXCEPT the last paragraph? In other words, how do I match everything before "<p>Cast:"?
 
Back
Top