[心得] HTML 取 tag內的text

作者: nfsong (圖書館我來了)   2014-07-17 15:22:50
因為最近需要取tag內的資料
<Cell>
<Data ss:Type="String">資料A</Data>
</Cell>
<Cell>
<Data ss:Type="String">資料B</Data>
</Cell>
match
資料A
資料B
爬文了一下好像板上的不太一樣
找到了一個regex
(?<=>).*(?=<)
match >後面的字不包括>
match <前面的字不包括<
不過複雜的資料可能要在判斷一下
作者: lin1987www (林奕忠)   2014-07-23 21:23:00
還好用到多行模式,不然會取到換行xd 但這想法真不錯:)

Links booklink

Contact Us: admin [ a t ] ucptt.com