How to import URLs from Google page to listview
-
I have retrived an web page content in one text box, now I want to retrive URLs from that content.So how can I do this.because different URLs have different Length and patterns so I am in trouble.Can any body help me? Raj
-
I have retrived an web page content in one text box, now I want to retrive URLs from that content.So how can I do this.because different URLs have different Length and patterns so I am in trouble.Can any body help me? Raj
you have to use regular expressions for something like this.
using System.Text.RegularExpressions; string linkPattern = "href\s*=\s*(?:""(?[^""]*)""|(?\S+))"; Regex linkRegex = new Regex(linkPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); Match linkMatch = linkRegex.Match(page); //where page == your web content while(linkMatch.Success) { //link is the url now. string link = linkMatch.Groups(1).Value.ToString(); .... //do what you need to do linkMatch = linkMatch.NextMatch(); }
-- modified at 16:10 Monday 13th March, 2006