比如:<a href="http://itunes.apple.com/cn/app/the-abolition-man-the-great/id392965200?mt=8">
The Abolition of Man and The Great Divorce (by C.S. Lewis) (UNABRIDGED AUDIOBOOK) : Blackstone Audio...
</a>
请问我要获取所有链接地址以 http://itunes.apple.com/cn/app/开头的链接的链接地址的正则表达式怎么写?
我最终要获取的就是 http://itunes.apple.com/cn/app/the-abolition-man-the-great/id392965200?mt=8这个字符串
The Abolition of Man and The Great Divorce (by C.S. Lewis) (UNABRIDGED AUDIOBOOK) : Blackstone Audio...
</a>
请问我要获取所有链接地址以 http://itunes.apple.com/cn/app/开头的链接的链接地址的正则表达式怎么写?
我最终要获取的就是 http://itunes.apple.com/cn/app/the-abolition-man-the-great/id392965200?mt=8这个字符串
void Main()
{
string html=@"<a href=""http://itunes.apple.com/cn/app/the-abolition-man-the-great/id392965200?mt=8"">
The Abolition of Man and The Great Divorce (by C.S. Lewis) (UNABRIDGED AUDIOBOOK) : Blackstone Audio...
</a>";
foreach(Match m in Regex.Matches(html,@"http://itunes.apple.com/cn/app/[^""]*"))
{
Console.WriteLine(m.Value);
}
}/*
http://itunes.apple.com/cn/app/the-abolition-man-the-great/id392965200?mt=8
*/
foreach (Match m in mc)
{
Response.Write(m.Groups[ "url "].Value);
Response.Write(m.Groups[ "text "].Value);
}
void Main()
{
string html=@"<a class=""paginate-more"" href=""http://itunes.apple.com/cn/genre/mobile-software-applications/id6018?mt=8&letter=A&page=2#page"">Next</a>";
foreach(Match m in Regex.Matches(html,@"(?is)<a([^>]*)class=(['""]?)paginate-more\2\1href=\2(?<url>[^'""]*)\2>"))
{
Console.WriteLine(m.Groups["url"].Value);
}
}/*
http://itunes.apple.com/cn/genre/mobile-software-applications/id6018?mt=8&letter=A&page=2#page
*/