我要通过C#取得所有超连接

来源:百度知道 编辑:UC知道 时间:2024/06/04 01:47:35
我想通过C#提取所有文本框内所有的超连接怎么取的呢
请高手们帮我一个忙
通过C#程序实现,比如里面有全部文本信息,
[b]如以下内容:[/b]
http://zhidao.baidu.com/question/102440411.html里面的还其它信息,包手<A等...
http://zhidao.baidu.com/question/105773275.html
<a href="/question/102440411.html">新闻</a>
<a href="/question/102440412.html">新闻</a>
<a href="/question/102440413.html">新闻</a>
<a href="/question/102440414.html">新闻</a>
....等..
textBox.text里面所有的网页超连接取出来放到ListBox1.text里面

用什么方法把textBox.text的所以超连接取出来的呀

System.Text.RegularExpressions.Regex R = new System.Text.RegularExpressions.Regex("http://\\w+([-.]\\w+)*.\\w+([-.]\\w+)*(:\\d+)*(/[-\\w%?&=]*)*");
Match M = R.Match(textBox.text);
while (M.Success)
{
ListBox1.Items.Add(new ListItem(M.Value));
M = M.NextMatch();
}

正则表达式