0
我正在使用下面的代码尝试获取两个标签之间的一些html。到目前为止,我有这样的:我应该如何处理这种正则表达式?
$pattern = "/<span style='text-decoration:none;color:#fff;font-family: verdana,geneva,sans-serif;font-size:12px'>(.*?)<\/span>/s";
preg_match($pattern, $html, $episodes);
echo '<pre>';
var_dump($episodes);
echo '</pre>';
die();
这是厌烦到$ HTML变量
<span style="text-decoration:none;color:#fff;font-family: verdana,geneva,sans-serif;font-size:12px">
<b><span style='font-size:18px'>The Walking Dead</span></b><br><br><br><br><b>1x01 - <a style='text-decoration:underline;color:#ffffcc;font-family: verdana,geneva,sans-serif;' href='/?12&tv=1'>Days Gone Bye</a></b><br><br>
</span>
我只是试图让HTML的该块出来的样本数据。任何想法为什么模式不匹配?
不要解析HTML正则表达式 – 2013-12-19 19:04:21
扩大,你应该使用DOM解析器。我个人喜欢这个:http://simplehtmldom.sourceforge.net/ – Jessica
http://www.php.net/manual/en/class.domdocument.php – Sammitch