2011-08-03 76 views
0

我有這個HTML文檔:如何使html-comment與preg_match_all(PHP)匹配?

<!--SETTINGS 
title: This is the title 
keywords: dummy, title, longer keyword, another 
description: This is the description of the page 
--> 

dit is de home dit is de homedit is de homedit is de homedit is de home 
dit is de home 
dit is de home 
dit is de home 
dit is de homedit is de homedit is de homedit is de home 
dit is de homedit is de homedit is de home 

現在,我想從開頭處匹配的評論。我想我的正則表達式模式是這樣的:

<!--SETTINGS([\s\S])*--> 

當我在測試:http://regexr.com?2ucae,一切似乎工作像它應該。 當我把它放在PHP中,我得到一個錯誤:Fout 101(net :: ERR_CONNECTION_RESET):連接丟失。

我在做什麼錯?

+0

中的XPath'//評論() '將匹配DOMDocument中的所有註釋。 – Gordon

回答