PHP preg_match_all + str_replace
问题 I need to find a way to replace all the <p> within all the <blockquote> before the <hr />. Here's a sample html: <p>2012/01/03</p> <blockquote> <h4>File name</h4> <p>Good Game</p> </blockquote> <blockquote><p>Laurie Ipsumam</p></blockquote> <h4>Some title</h4> <hr /> <p>Lorem Ipsum</p> <blockquote><p>Laurel Ipsucandescent</p></blockquote> Here's what I got: $pieces = explode("<hr", $theHTML, 2); $blocks = preg_match_all('/<blockquote>(.*?)<\/blockquote>/s', $pieces[0], $blockmatch); if (