我工作的正则表达式查找文本的整个堆里面如何使用PHP中的正则表达式解析此HTML?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
坐在那里,说菜单的结束标记......它看起来像这样:
<!--END MENU-->
这是我编写的代码,但并未将匹配文字吐出:
$value = preg_match('/^<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">(.*?)<!--END MENU-->/',$content, $matching_text);
echo $matching_text[0]
读http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-标签/ 1732454#1732454。 – Ms2ger 2010-10-16 17:33:56