0
一個html標籤內容我有一些HTML代碼,其中包含這些:如何抓住與preg_match_all
<table class="qprintable2" width="100%" cellpadding="4" cellspacing="0" border="0">
content goes here !
</table>
我有這個功能來匹配裏面
function getTextBetweenTags($string, $tagname)
{
$pattern = "/<table class=\"class1\" width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">(.*?)<\/$tagname>/";
preg_match_all($pattern, $string, $matches);
return $matches[1];
}
的標籤,但它不有,所以我會高度讚賞,如果你能給我一個很好的模式:(
可能重複http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml -self-contained-tags) – 2010-12-18 02:34:47
AWESOMEST REGEX HTML PARSER EVAR:http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – 2010-12-18 02:36:03