-1
$ohtml = '<!--#comp: {}-->I am HTML and whatever else<!--##comp-->';
preg_match_all('/\Q<!--#comp\E(.*?)\Q<!--##comp-->\E/', $othml, $match);
print_r($match);
完美的作品上http://regex101.com/但是在PHP它提出了500服务器错误PHP正则表达式工作regex101但不是在PHP
请注意,您在这里没有任何可以逃脱的地方,您应该删除所有无用的'\ Q ... \ E'。 –