-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'。 –