She*_*bic 4 php regex xpath domdocument
假设我有一个HTML页面如下:
<!-- This is the opening tag -->
<div class="content_text">
<div>Title</div>
<div>Author Name</div>
<div>Some complicated HTML elements correctly validated</div>
<b>Some more text</b>
<img ... />
<div> more and more text </div>
</div><!-- This is the correct closing tag -->
Run Code Online (Sandbox Code Playgroud)
如何获取div的开头class="content_text"
和正确的结束标记之间的内容?
我尝试了正则表达式,但我找不到任何简单甚至难以实现的方法.
我试过XPath,但我仍然无法获得内容.相反,我得到了外部div中的文本.