呵呵,不好意思,老是在提正则问题
下面是关于匹配table标签之间内容的问题
string match="<table[^>].*?>.*?<\\/table>";
但是没有结果,表格的嵌套怎么算
help please

解决方案 »

  1.   

    trystring match="<table[^>]*?>[\\s\\S]*?</table>";>>>表格的嵌套怎么算see an example about nested constructs in chapter 9 in Mastering Regular Expressions, 2nd Editionhttp://www.oreilly.com/catalog/regex2/
      

  2.   

    string match="<table[^>].*?>.*?<\\/table>";==>string match="<table.*?<\\/table>";
      

  3.   

    string match="(<table)[?>].*?.*(<\\/table>)";
      

  4.   

    不好意思啊,都没有得到完全的匹配,得到这样的数据,看到有2个tabel没有匹配到的<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">   <tr>     <td width="498"> <table width="100%" border="0" cellspacing="0" cellpadding="0">          <tr>            <td><a href="http://www.scut.edu.cn/page/view1.htm"><img src="images/nhu.jpg" width="496" height="105" border="0"></a></td>         </tr>         <tr>            <td><img src="images/n5.gif" width="498" height="4"></td>         </tr>         <tr>            <td height="75" align="center" valign="middle" class="table1">              <table width="494" border="0" cellspacing="0" cellpadding="0">               <tr>                 <td width="498" height="25" align="center">                    <table width="98%" border="0" cellspacing="0" cellpadding="0">                     <form action="https://security.scut.edu.cn/cas/login" method=post enctype="application/x-www-form-urlencoded">                       <tr>                          <td width="43"><img src="images/user.gif" width="32" height="15" align="absmiddle"></td>                         <td width="76"><input name="username" type="text" class="input1" size="8"></td>                         <td width="41"><img src="images/pw.gif" width="31" height="15" align="absmiddle"></td>                         <td width="75"><input name="password" type="password" class="input1" size="8">                            <input type="hidden" name="service" value="http://my.scut.edu.cn:8000/login" /></td>                         <td width="65"><input name="submit" type="image" src="images/search-_10.jpg" width="50" height="19" border="0"></td>                         <td width="21"><font color="#000099" size="3">|</font></td>                         <td width="82"><a href="http://cwis.scut.edu.cn:7070/mis/person/search.jsp" target="_blank"><img src="images/search-_12.jpg" width="72" height="19" vspace="6" border="0"></a></td>                         <td width="81"><a href="http://search.scut.edu.cn/index.html" target="_blank"><img src="images/xxi_14.jpg" width="72" height="19" border="0"></a></td>                       </tr>                     </form>    
    </table>
      

  5.   

    思归的正则表达式很好用啊,不仅table换作其它的有空格,回车都不怕,强!楼主快给分了
      

  6.   

    做一个dhtmlediter这个控件的时候也需要取出页面里面某个元素!