可能重複:
Xpath not behaving for me in parsing basic html如何使用正則表達式檢索DIV的內容?
我知道如何從靜態的名字一個div(即總是在整個頁面相同)獲取內容。然而,我的情況是「post_id_xxxxx」,這樣的事情:
<div id="post_id_12345">abc</div>
<div id="post_id_67890">abc</div>
<div id="post_id_31234">abc</div>
我想提取「ABC」字符串,但似乎很難給我,因爲每一個div有不同的ID。
謝謝。
你不知道。 [時段](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454)。 – delnan 2011-03-13 22:03:24
[Xpath不能在解析基本html時爲我工作](http://stackoverflow.com/questions/5249492/xpath-not-behaving-for-me-in-parsing-basic-html)。注意對接受答案的評論。如果您只是懶得使用搜索功能,您應該能夠找到很多其他重複項。 – Gordon 2011-03-13 22:13:18