如图 站长工具测试的正则表达式匹配结果和php运行preg_match_all后结果完全不同
下面是php运行的
array(21) {
[0]=>
string(2) "15"
[1]=>
string(10) "2019-20202"
[2]=>
string(9) "教务处"
[3]=>
string(5) "00773"
[4]=>
string(12) "美术鉴赏"
[5]=>
string(6) "选修"
[6]=>
string(12) "网络课程"
[7]=>
string(3) "2.0"
[8]=>
string(0) ""
[9]=>
string(9) "</td><td>"
[10]=>
string(0) ""
[11]=>
string(9) "</td><td>"
[12]=>
string(0) ""
[13]=>
string(15) "</td><td>合格"
[14]=>
string(6) "合格"
[15]=>
string(0) ""
[16]=>
string(10) "</td><td>-"
[17]=>
string(0) ""
[18]=>
string(9) "</td><td>"
[19]=>
string(0) ""
[20]=>
string(138) "</td><td><divclass="cz_buttoncz_see"title="查看"onclick="javascript:queryCjView('1211482231','2019-2020-2-00773-2019183101','');"></div>"
}
php源码
<?php
$str = <<<BEGIN
--><tr><td>15</td><td>2019-20202</td><td>教务处</td><td>00773</td><td>美术鉴赏</td><td>选修</td><td>网络课程</td><td>2.0</td><td></td><td></td><td></td><td>合格</td><td>合格</td><td></td><td>-</td><td></td><td></td><td><divclass="cz_buttoncz_see"title="查看"onclick="javascript:queryCjView('1211482231','2019-2020-2-00773-2019183101','');"></div></td></tr>
BEGIN;
$isMatched2 = preg_match_all('/(?<=<td>)(.*?)(?=<\/td>)/iu', $str, $matches2);
var_dump($matches2[0]);
?>
我现在想匹配的是站长工具那样的(18条匹配那个) 请问正则怎么写
谢谢