正则求助!麻烦正则下!

qqsweb 2007-02-08 11:46:18
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
晕<br />
动作这么快<br />
我还在想呢,怎么刚刷新了一下就没了</div></div>
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
引用
原帖由 秀才无为 于 2006-12-1 22:08 发表<br />
晕<br />
动作这么快<br />
我还在想呢,怎么刚刷新了一下就没了
<br />
<br />
呵呵,刚刚看了,感觉很好,写的很到位很实际,以前就有过这个想法,特别是第六条!:baiyplait:</div></div>
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
我认为第5条说的即是!!!</div></div>
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
写的很好,很具体:132: 支持你!:102:</div></div>
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
说得好~论坛质量高还得靠大家!:fan:</div></div>

我想取<div class="subtable altbg2 t_msg" style="width: auto;height: auto">

</div></div>
之间的内容如何写?
...全文
279 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqsweb 2007-02-09
  • 打赏
  • 举报
回复
重新试过了两个都行!是我自己的问题前面没有用preg_match_all这个函数,我是直接将正则用别的地方了,所以才没有用!感谢大家帮助!
yiwusuo 2007-02-08
  • 打赏
  • 举报
回复
上面的正则可以取,你再试,是不是你想要的

preg_match_all('/<div[^>]*>(.*)<\/div>/isU',$text,$content);
echo implode('',$content[1]);
qqsweb 2007-02-08
  • 打赏
  • 举报
回复
preg_match_all("'<div.*>(.*)<\/div>'iUsx", $document, $content);
print_r($content);
这个不行啊!
因为所有的html代码不是连贯的,中间有回车也就是换行!只有所有html代码紧凑在一起才可以取到!
有其他正则吗
uuq 2007-02-08
  • 打赏
  • 举报
回复
preg_match_all("'<div.*>(.*)<\/div>'iUsx", $document, $content);
print_r($content);
yiwusuo 2007-02-08
  • 打赏
  • 举报
回复
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
</div></div>

这是什么标签,也不对称啊,本身有错误

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧