我試圖從http://www.auctionarms.com/search/displayitem.cfm?itemnum=9736364&oh=216543中提取「Florida(FL)」。 我的代碼是preg_match,regexp,php,從html中提取文本
//get location $pattern = "/(State)</i>:</td>(.*)</td>/"; preg_match_all($pattern, $htmlContent, $matches); print_r($matches);任何想法爲什麼不工作?
這似乎是SO的不變口頭禪:避免使用正則表達式來解析html,如果可能的話。它不是工作的工具。 – 2010-05-22 04:20:31