简体   繁体   English

如何将HTML注释与preg_match_all(PHP)匹配?

[英]How to match html-comment with preg_match_all (PHP)?

I have this HTML-document: 我有这个HTML文档:

<!--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

Now, I'd like to match the comment at the beginning. 现在,我想在开头匹配注释。 I think my regex-pattern looks like this: 我认为我的正则表达式模式如下所示:

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

When I test it in: http://regexr.com?2ucae , everything seems to work like it should. 当我在http://regexr.com?2ucae中进行测试时,一切似乎都可以正常工作。 When I put it in PHP, I get an error: Fout 101 (net::ERR_CONNECTION_RESET): Connection lost. 当我将其放入PHP中时,出现错误:Fout 101(net :: ERR_CONNECTION_RESET):连接丢失。

What am I doing wrong? 我究竟做错了什么?

The error has nothing to do with your regex-pattern 该错误与您的正则表达式模式无关

Check your computer for malware and do some research about ERR_CONNECTION_RESET 检查您的计算机上是否存在恶意软件, ERR_CONNECTION_RESET进行一些研究

Example: http://www.google.com/support/forum/p/Chrome/thread?tid=476f762a0f84017f&hl=en 示例: http : //www.google.com/support/forum/p/Chrome/thread?tid=476f762a0f84017f&hl=zh-CN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM