<span class="g">  www.doc88.com/提取:www.doc88.com跪求了!

解决方案 »

  1.   


                    string inputstring = "<span class=\"g\">www.doc88.com/";
                    string pattern = "<span class=\"g\">";
                    string replacement = "";
                    inputstring = System.Text.RegularExpressions.Regex.Replace(inputstring, pattern, replacement).Replace("/","");
      

  2.   

     string test = @"<span class=""g""> www.doc88.com/";
                string pattern = @"(?i)<span[^>]*?class=(['""]?)g\1[^>]*?>\s*?((http://)?.*?\.com)";
                string href = Regex.Match(test, pattern).Groups[2].Value;
                // www.doc88.com
      

  3.   

    兄弟
    你这个很给力
    确实管用但是我抓取:http://www.baidu.com/s?wd=site%3Agov.cn
    显示确实是这样的
    跪求帮忙看看代码:Regex reg = new Regex(@"(?i)<span[^>]*?class=(['""]?)g\1[^>]*?>\s*?((http://)?.*?\.com)");
    MatchCollection mc = reg.Matches(thecode);
     foreach (Match m in mc)
                {
                    richTextBox1.Text += m.Groups[2].Value+ "\n";
                }
      

  4.   

    Try
    string pattern = @"(?i)<span[^>]*?class=(['""]?)g\1[^>]*?>\s*?((http://)?[^/\s<>]+)";