【发布时间】:2010-11-18 21:28:19
【问题描述】:
我需要一个 php 中的正则表达式来匹配元素标签之间的内容,例如<body> 和 </body> 与 perl 兼容 preg_match。
到目前为止,我尝试过:
// $content is a string with html content
preg_match("/<body(.|\r\n)*\/body>/", $content, $matches);
print_r($matches);
…但打印输出是一个空数组。
【问题讨论】:
标签: php regex multiline matching