<html>
......
......
<table id=hehe>
<tr><td></td></tr>
</table>
<table>
<tr>
<td>
<input type=hidden id=1>
<input type=hidden id=2>
<input type=hidden id=3>
<input type=hidden id=4>
</td>
</tr>
</table>
.......
.......
</html>一个页面里面包含一个这样的table,我想获得其中的每个input,我是这样写的:(?<=<table\s*id=hehe>((?!<table).)*?</table>\s*?)<table>((?!<table).)*?(?<ceshi><input[^>]*?>)(.*?)</table>先靠第一个去定位,然后在筛选,但是这样的结果是<input type=hidden id=1>
选出来了,也就是说把第一个筛了出来,我想实现这四个input都匹配,都能被筛出来,怎么改改!!!各位大虾帮忙!!!

解决方案 »

  1.   

    ^<input type=\([a-zA-z]*\) id=\([0-9]*\)>
    \1就是TPYE
    \2就是ID
      

  2.   

    页面内还有其他的<input  和table 先需要定位的
      

  3.   

    Regex reg=new Regex("^<input type=hidden id=([0-9]*)>");foreach(Match result in reg.Matches(desStr))
    {
       string test=result.Group[1].ToString();
    }like this
      

  4.   

    deadshot123(随风缘)这样会筛出其他许多没用的input,这几个是有用的我写到了这,还有其他的没用的input我没写出来
      

  5.   

    1、没用的input跟有用的input对比 附近的字符串有区别
    如果有区别就可以修改正则表达式
    2、没用的input跟有用的input对比 附近的字符串没有任何区别
    所要结果在匹配结果集中索引都一样,比如你要的Group[1],只需读到Group[1]即可
    3、没用的input跟有用的input对比 附近的字符串没有任何区别,而且所要结果在匹配结果集中索引不定
     那也没有办法。
      

  6.   

    input 位置不特殊,名字也不特殊,特殊的是他周围的table
      

  7.   

    1、没用的input跟有用的input对比 附近的字符串有区别
    如果有区别就可以修改正则表达式