This problem is much better suited for an XML parser, and it makes your code more readable as well. Code snippet:
$dom = new DOMDocument(); $dom->loadHTML($txt); $items = $dom->getElementsByTagName('p'); foreach ($items as $paragraph) { echo $paragraph->nodeValue; // You can also manipulate and update the nodeValue within this loop as well } Jim Yi On Wed, Jan 12, 2011 at 9:25 AM, Randal Rust <randalr...@gmail.com> wrote: > On Wed, Jan 12, 2011 at 9:20 AM, Dan Cech <dc...@phpwerx.net> wrote: > > > Good call, I missed the multiple-line thing. In this situation though > you'd > > actually want /s like: > > > > $blockpattern='/<p[^>]*>.*?<\/p>/s'; > > That's it. I tried it with /m, but it gave me 0 results. Replaced with > /s and now I have the array of 33 paragraphs, as expected. Thanks for > the help! > > -- > Randal Rust > R.Squared Communications > www.r2communications.com > www.facebook.com/r2communications > 614-370-0036 > _______________________________________________ > New York PHP Users Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/Show-Participation >
_______________________________________________ New York PHP Users Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/Show-Participation