string webDocContent="":
string strPattern=@"a[\s]+href=(?<Link>[^\s>]+)[^>]*>(?<Text>[^<]*)</a>";
MatchCollection Matches=Regex.Matches(webDocContent,strPattern,RegexOptions.IgnoreCase|RegexOptions.Compiled);
foreach(Match NextMatch in Matches)
{
string URL=NextMatch.Groups["Link"].Value.ToString().Trim();
string URLText=NextMatch.Groups["Text"].Value.ToString().Trim();
Response.Write(URL);
Response.Write(URLText);
}
判断URLText内容是否为下一页
string strPattern=@"a[\s]+href=(?<Link>[^\s>]+)[^>]*>(?<Text>[^<]*)</a>";
MatchCollection Matches=Regex.Matches(webDocContent,strPattern,RegexOptions.IgnoreCase|RegexOptions.Compiled);
foreach(Match NextMatch in Matches)
{
string URL=NextMatch.Groups["Link"].Value.ToString().Trim();
string URLText=NextMatch.Groups["Text"].Value.ToString().Trim();
Response.Write(URL);
Response.Write(URLText);
}
判断URLText内容是否为下一页
Match m = reg.Match(yourStr);
if (m.Success)
{
richTextBox2.Text = m.Groups["url"].Value;
}