我get 获得HTML 源码,需要写正则表达式 比配
<td nowrap style="font-family:Verdana;font-size:11pt;">
获得这里里面的内容</td>里面有很多这样的标签
 postStr = "<td nowrap style=\"font-family:Verdana;font-size:11pt;\">.*?</td>";
这样写不正确吗?

解决方案 »

  1.   

    postStr = "(?s)<td nowrap style=\"font-family:Verdana;font-size:11pt;\">.*?</td>";
      

  2.   

    小数点是不匹配换行符的,需要加(?s)            Regex reg = new Regex("(?is)<td nowrap style=\"font-family:Verdana;font-size:11pt;\">(.*?)</td>");
                MatchCollection mc = reg.Matches(yourStr);
                foreach (Match m in mc)
                {
                    richTextBox2.Text += m.Groups[1].Value + "\n";
                }
      

  3.   

    <td nowrap style="font-family:Verdana;font-size:11pt;">([\s\S]+?)/td>