-1

Possible Duplicate:
How to use regular expressions to parse HTML in Java?

I need to count all url on page with Java. I'm beginer in Java. I need advice in what technology I should use to count url. I think i can use regular expressions to detect url and count urls, but I'm not shure

Community
  • 1
  • 1
  • I would first write a program that can download the page. Have you gotten that far? If you are having a problem with something particular post some code showing what you have tried. – km1 Sep 12 '12 at 13:39
  • We need more. Please confirm: you want a JAVA algorithm that open a connection to an URL, get the HTML content, and count the number of `` tags within it? – sp00m Sep 12 '12 at 13:39
  • @sp00m & km1: user1595557 already states `I'm beginer in Java`. `I need advice in what technology ..`, so I don't think so he/she will clearly understands what you both are getting at (though the questions you have asked see logical), and I think user1595557 requires some hint or starting point to try out something. Thanks – Prakash K Sep 12 '12 at 13:52
  • Sorry for the stupid questions. Full task is : – user1595557 Sep 12 '12 at 13:54

2 Answers2

0

Could you use a count of url passed to applet? jQuery would easily give you that as in: var aCnt = $('a').size(); aCnt being the count of a tags. More on it here.

vector
  • 7,334
  • 8
  • 52
  • 80
0

Have a look at jsoup:

Document doc = Jsoup.connect("http://www.your-url.com/").get();
Elements links = doc.select("a");
int count = links.size();
sp00m
  • 47,968
  • 31
  • 142
  • 252