目前有这么一个字串"<TR>http://111</TR>"
用c#语言,用正则式,分解成string1="<TR>111</TR>"和
string2="<TR>222</TR>"
ht
目前这个正则式我想不出怎么写。
如何获取中的内容

解决方案 »

  1.   

    如何获取Response.Write(m.Groups["imgurl"].Value+"==");
      

  2.   


    运行结果有出入的
    mg]http://www.bbs.com/200682314_233aabb872-980.jpg[/im
      

  3.   

    测试数据
    "<TR>http://111</TR>"
    正则:
    (?<=\[img\]).*?(?=\[/img\])
    结果:
    捕获 1 :
        http://www.bbs.com/200682314_233aabb872-980.jpg
    ==============================华丽的分隔线===============================
    正则测试页http://www.17897.com/regextext.aspx
      

  4.   

    Regex objRegEx = new Regex(@"\[img\](?<imgurl>.*)\[/img\]");加了点
      

  5.   

    string strRegex = @"(?<=\[img\]).*?(?=\[/img\])";  string htmlCode = @"<TR>http://111</TR>";
    Regex r = new Regex(strRegex,RegexOptions.IgnoreCase); 
    MatchCollection m = r.Matches(htmlCode); 
    for(int i=0; i<=m.Count-1; i++) 

    bool rep = false; 
    string strNew = m[i].ToString();  Console.WriteLine(strNew);
    }测试通过了