现有一字符串:
<td><a rel="external" href='http://hi.csdn.net/'>空间</a></td>
<td><a rel="external" href='http://news.csdn.net/'>新闻</a></td>
<td><a rel="external" href='http://bbs.csdn.net/'>论坛</a></td>
<td><a rel="external" href='http://blog.csdn.net/'>Blog</a></td>
<td><a rel="external" href='http://download.csdn.net/'>下载</a></td>
<td><a rel="external" href='http://book.csdn.net/'>读书</a></td我要获取href='这里的内容' 应该怎么做,把所有截取出来的URL地址存放在一个字符串数组里吧,急用,谢谢各位仁兄了!!!!

解决方案 »

  1.   

    try...
    MatchCollection mc = Regex.Matches(yourStr, @"(?<=href=(['""]?))[^""'\s>]+(?=\1)", RegexOptions.IgnoreCase);
    foreach (Match m in mc)
    {
        richTextBox2.Text += m.Value + "\n";
    }
      

  2.   

    如果只有上面那些字符串:这样就可以了
    '定义一个空的集合
            Dim MyCollection As New Collection
            MyCollection.Clear()Dim re As New Regex("http://[a-zA-Z\.]*\b", RegexOptions.None)
    Dim mc As MatchCollection = re.Matches("text")For Each ma As Match in mc
     MyCollection.Add(ma.Value)
    Next数组(1)=MyCollection.Item(1)
    ......