search

Home  >  Q&A  >  body text

php - 求正则表达式

<p class="quote"><p class="quote-hd"><span class="floor">第1楼</span>哈哈哈</p><p class="quote-bd"><p>ceshi</p><p><img src="public/js/ueditor143/dialogs/emotion/images/classic/007.gif"/></p></p></p>

我的正则,preg_match('/<p class='quote-hd'><span class='floor'>(.?)</span>(.?)</p><p class='quote-bd'>(.*?)</p>/is', $quote_content, $match);
取不到值。。。。
目标取出:
第1楼
哈哈哈
<p>ceshi</p><p><img src="public/js/ueditor143/dialogs/emotion/images/classic/007.gif"/></p>

ringa_leeringa_lee2775 days ago685

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-10 18:12:07

    $s='<p class="quote"><p class="quote-hd"><span class="floor">第1楼</span>哈哈哈</p><p class="quote-bd"><p>ceshi</p><p><img src="public/js/ueditor143/dialogs/emotion/images/classic/007.gif"/></p></p></p>';
    
    preg_match('#<p class="quote-hd"><span class="floor">(.*?)</span>(.*?)</p><p class="quote-bd">(.*?)</p>#is', $s, $match);
    print_r($match);

    reply
    0
  • Cancelreply