14 个解决方案
#1
捕捉a标签
#2
怎么写啊!能不能给个源码或函数或表达式!!
#3
顶下
#4
用正则表达式
#5
TextBox2.Text = "";
string web_url = this.TextBox1.Text;//"http://blog.csdn.net/21aspnet/"
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream());
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
ArrayList my_list = new ArrayList();
string p = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex re = new Regex(p, RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(all_code);
for (int i = 0; i <= mc.Count - 1; i++)
{
bool _foo = false;
string name = mc[i].ToString();
foreach (string list in my_list)
{
if (name == list)
{
_foo = true;
break;
}
}//过滤
if (!_foo)
{
TextBox2.Text += name + "\n";
}
}
string web_url = this.TextBox1.Text;//"http://blog.csdn.net/21aspnet/"
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream());
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
ArrayList my_list = new ArrayList();
string p = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex re = new Regex(p, RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(all_code);
for (int i = 0; i <= mc.Count - 1; i++)
{
bool _foo = false;
string name = mc[i].ToString();
foreach (string list in my_list)
{
if (name == list)
{
_foo = true;
break;
}
}//过滤
if (!_foo)
{
TextBox2.Text += name + "\n";
}
}
#6
MatchCollection matchs = Regex.Matches(HTML,@"<a>(?<url>[^<]*)</a>", RegexOptions.IgnoreCase);
#7
foreach (Match m in matchs)
{
str += m.Groups["url"].Value;
}
{
str += m.Groups["url"].Value;
}
#8
现在我使用tds__609(学历代表过去、能力代表现在、学习力代表未来)
的代码能够获得,但连接同什么图片等连接也一起获得了,现在我只想要<a里边的连接,表达式应该怎么写?????
的代码能够获得,但连接同什么图片等连接也一起获得了,现在我只想要<a里边的连接,表达式应该怎么写?????
#9
<a里还有不包括内部连接也要啊!!!
#10
<a href=[^<]*>
#11
楼上的,不行啊!
#12
比较急,求老手救!!
#13
再顶下!!!
#14
up
#1
捕捉a标签
#2
怎么写啊!能不能给个源码或函数或表达式!!
#3
顶下
#4
用正则表达式
#5
TextBox2.Text = "";
string web_url = this.TextBox1.Text;//"http://blog.csdn.net/21aspnet/"
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream());
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
ArrayList my_list = new ArrayList();
string p = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex re = new Regex(p, RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(all_code);
for (int i = 0; i <= mc.Count - 1; i++)
{
bool _foo = false;
string name = mc[i].ToString();
foreach (string list in my_list)
{
if (name == list)
{
_foo = true;
break;
}
}//过滤
if (!_foo)
{
TextBox2.Text += name + "\n";
}
}
string web_url = this.TextBox1.Text;//"http://blog.csdn.net/21aspnet/"
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream());
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
ArrayList my_list = new ArrayList();
string p = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex re = new Regex(p, RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(all_code);
for (int i = 0; i <= mc.Count - 1; i++)
{
bool _foo = false;
string name = mc[i].ToString();
foreach (string list in my_list)
{
if (name == list)
{
_foo = true;
break;
}
}//过滤
if (!_foo)
{
TextBox2.Text += name + "\n";
}
}
#6
MatchCollection matchs = Regex.Matches(HTML,@"<a>(?<url>[^<]*)</a>", RegexOptions.IgnoreCase);
#7
foreach (Match m in matchs)
{
str += m.Groups["url"].Value;
}
{
str += m.Groups["url"].Value;
}
#8
现在我使用tds__609(学历代表过去、能力代表现在、学习力代表未来)
的代码能够获得,但连接同什么图片等连接也一起获得了,现在我只想要<a里边的连接,表达式应该怎么写?????
的代码能够获得,但连接同什么图片等连接也一起获得了,现在我只想要<a里边的连接,表达式应该怎么写?????
#9
<a里还有不包括内部连接也要啊!!!
#10
<a href=[^<]*>
#11
楼上的,不行啊!
#12
比较急,求老手救!!
#13
再顶下!!!
#14
up