Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL url = new URL("http://www.montignac.com/it/ricerca-dell-indice-glicemico");
- HttpURLConnection http = (HttpURLConnection) url.openConnection();
- Scanner scanner = new Scanner(http.getInputStream());
- StringBuilder builder = new StringBuilder("");
- while(scanner.hasNextLine())
- {
- builder.append(scanner.nextLine());
- builder.append("\r\n");
- }
- Pattern pattern = Pattern.compile("<div class=\"item-title-tab\">(.+)</div>\r\n<div class=\"item-ig-tab\">IG (\\d+?)</div>");
- Matcher matcher = pattern.matcher(builder.toString());
- while(matcher.find())
- {
- System.out.println(matcher.group(1) + ";" + matcher.group(2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement