2011-08-03 79 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

回答