作者z101924512 (grapefruit623)
看板RegExp
標題[問題] 抓取文章段落
時間Thu Apr 12 13:50:50 2012
/*
聽說註明使用的語言、環境
*
問題有可能較容易被解決...
*/
使用語言:python
<doc>
文章段落一
</doc>
<doc>
文章段落二
</doc>
如何用正規表示式針對tag「個別」取出段落一與二
像是/<doc>.*</doc>/會忽略中間的</doc> <doc> 會同時抓到段落一與二
不知道要怎樣寫才行,才能正確配對tag
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.121.80.138
推 LPH66:.*? 這是常見問題了 關鍵字 greedy match 04/12 14:14
→ z101924512:以解決~感謝 04/15 00:29