日期:2014-05-19  浏览次数:20725 次

求读取多个嵌套标签的网页html正则表达式
html如下:

<table   width=100%   border=0   cellspacing=0   cellpadding=0   style= "line-height:15pt; "> <tr> <td> <span   style=font-size:12px;> [求助]新名称!!谢谢!拜托了 <br>
编辑 <br>
名称! <br>
拜托各位了! <br>
<img   src= "../images/UBBicon/em03.GIF "   width=20   height=20   align=absmiddle   border=0> <img   src= "../images/UBBicon/em03.GIF "   width=20   height=20   align=absmiddle   border=0> </span> </td> </tr> </table>


我想从中提取到:

[求助]新名称!!谢谢!拜托了 <br>
编辑 <br>
名称! <br>
拜托各位了! <br>
<img   src= "../images/UBBicon/em03.GIF "   width=20   height=20   align=absmiddle   border=0> <img   src= "../images/UBBicon/em03.GIF "   width=20   height=20   align=absmiddle   border=0>


请问正则表达式应该怎么写?

我是这样写的:Regex   reg   =   new   Regex(@ " <table[^> ]*?> <tr[^> ]*?> <td[^> ]*?> <span[^> ]*?> (? <desc> [^ <]*?) </span> </td> </tr> </table> ");

但不行!

------解决方案--------------------
你到底想要什么样的结果,如果像你例子所说,我修改的那个就可以了,所以只是解释一下你的匹配不成功的原因

<table[^> ]*?> <tr[^> ]*?> <td[^> ]*?> <span[^> ]*?> (? <desc> [\s\S]*?) </span> </td> </tr> </table>