如下html串:
$str = '
1111111111
2222222222
link1
1111111111
2222222222
';
需要匹配出的结果:
将中的内容匹配出来, 即:
1=>
1111111111
2222222222
link1
2=>
1111111111
2222222222
php程序实现,在线等~
------解决方案--------------------
引用:$patten='/((*)
)/';
preg_match_all($patten,$str,$match);
没有这么简单.因为会有多个
,你应该从内层开始查找,然后一层一层的往外,知道匹配到
为止
------解决方案--------------------
((?>[^
]+
------解决方案--------------------
.+?
------解决方案--------------------
------解决方案--------------------
(?r))*)
#is', $str, $matches)){
print_r($matches);
}
?>