原字符串
<div style="padding-top:20px;padding-left:10px;padding-bottom:20px;" id="search_bar">
<div>
<form action="http://www.igimu.com/grammar.php" id="dictF">
<input type="text" value="авралить" style="width:530px" name="key" autocomplete="off" maxlength="2048" id="key" class="t_input">
<input type="submit" value="查  询" class="submit">
<a title="开启俄语软键盘" href="javascript: showkeyboard();">俄语键盘</a>
</form>
</div>
</div><div id="results">
<div class="trans-wrapper">
<h2>авралить</h2>
</div>
<hr>
<b>不定式:</b>  авра'лить 
<h2>主动语态</h2>
<h3>现在时</h3>
<tbody><tr>
<th align="left"></th>
<th align="left">单数形式</th>
<th align="left">复数形式</th>
</tr>
<tr>
<th align="left">第一人称</th>
<td align="left">авра'лю</td>
<td align="left">авра'лим</td>
</tr>
<tr>
<th align="left">第二人称</th>
<td align="left">авра'лишь</td>
<td align="left">авра'лите</td>
</tr>
<tr>
<th align="left">第三人称</th>
<td align="left">авра'лит</td>
<td align="left">авра'лят</td>
</tr>
</tbody>
</div>
<div id="bottom"></div>我想得到<div class="trans-wrapper">
<h2>авралить</h2>
</div>
<hr>
<b>不定式:</b>  авра'лить 
<h2>主动语态</h2>
<h3>现在时</h3>
<tbody><tr>
<th align="left"></th>
<th align="left">单数形式</th>
<th align="left">复数形式</th>
</tr>
<tr>
<th align="left">第一人称</th>
<td align="left">авра'лю</td>
<td align="left">авра'лим</td>
</tr>
<tr>
<th align="left">第二人称</th>
<td align="left">авра'лишь</td>
<td align="left">авра'лите</td>
</tr>
<tr>
<th align="left">第三人称</th>
<td align="left">авра'лит</td>
<td align="left">авра'лят</td>
</tr>
</tbody>也就是
<div id="results">这里面的内容</div>

解决方案 »

  1.   

    Regex reg = new Regex(@"(?is)(?<=<div[^>]*?id=""results""[^>]*?>).*?(?=</div>\s*<div[^>]*?id=""bottom""[^>]*?)");
      

  2.   

    (?<=<div id="results">)(.|\s)*(?=<div id="bottom"></div>)
      

  3.   

    string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));//读取txt
                    string pattern = @"(?isx)                      #匹配模式,忽略大小写,“.”匹配任意字符                      (?<=<div[^>]*?id=(['""]?)results[^>]*?>)                      #开始标记“<div...>”                          (?>                         #分组构造,用来限定量词“*”修饰范围                              <div[^>]*>  (?<Open>)   #命名捕获组,遇到开始标记,入栈,Open计数加1                          |                           #分支结构                              </div>  (?<-Open>)      #狭义平衡组,遇到结束标记,出栈,Open计数减1                          |                           #分支结构                              (?:(?!</?div\b).)*      #右侧不为开始或结束标记的任意字符                          )*                          #以上子串出现0次或任意多次                          (?(Open)(?!))               #判断是否还有'OPEN',有则说明不配对,什么都不匹配                      (?=</div>)                         #结束标记“</div>”                      "
    ;
                    tempStr = Regex.Match(tempStr,pattern).Value;
      

  4.   

    (?is)<div\sid=(['"]?)results\1>(?><div[^>]*>(?<o>)|</div>(?<-o>)|(?:(?!</?div\b).)*)*(?(o)(?!))</div>