I have the following C# code:
string MyString = "<a href=\"magnet:?xt=urn:btih:7f3befa467c4cac0787286c87ea264a0606066f5&dn=some.file.name.zip&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80\" title=\"Download this torrent using magnet\">...</a>[Some unwanted stuff here]<a href=[Another]>";
MatchCollection MyMatches = Regex.Matches(MyString, "(?<URL>magnet:\\?.*?)(?:\"|')");
foreach(Match MyMatch in MyMatches)
{
MessageBox.Show(MyMatch.Groups["URL"].Value);
}
My question is: how can I also put &dn=some.file.name.zip into a named group called <File>?
HtmlAgilityPack, to parse url, you have theUriandHttpUtilityclasses.