可能重複:
How to parse and process HTML with PHP?如何使用preg_match()提取文本?
我有以下存儲在一個變量$new
<div class="img">
<span style="float:left; color:#666;">1. </span>
<a href="/Books/info/J-R-R-Tolkien/The-Lord-of-the-Rings/0618640150.html?utm_term=lord+of+the+ring_1_1">
<img src="http://cdn-img-b-tata.infibeam.net/img/6a53fabc/157/0/9780618640157.jpg?wid=90&hei=113" width="90" height="113" border="0">
</a>
</div>
<span class="title">
<h2 class="simple"><a href="/Books/info/J-R-R-Tolkien/The-Lord-of-the-Rings/0618640150.html?utm_term=lord+of+the+ring_1_1"><em>Lord</em> of the <em>Rings</em></a></h2>
By
<a href="/Books/search?author=J R R Tolkien" style="font-size:12px; text-decoration:none;">J R R Tolkien</a>
<span style="color:#666666; font-size:11px;">[Paperback 2005, 50th Edition]</span>
</span>
<div class="price" style="line-height:30px;margin-top:0px;">
我要提取從開始到1. 
文本<div
文本。我嘗試了所有可能的解決方案,但沒有成功。
比利是真的。特別是當preg_match不是你需要的函數時,因爲它返回一個布爾值。好像你還沒有嘗試過很多。 – Jerska 2012-08-06 13:48:37
用REGEX解析HTML? s /(?<!拍攝自己在)腳/頭/ g – 2012-08-06 13:49:08
有[strip_tags](http://php.net/strip_tags) – dualed 2012-08-06 13:50:08