Java tutorial
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static ArrayList<String> getResultUrl(String html) { ArrayList<String> resultUrl = new ArrayList<String>(); String re = "<h3 class=\\\\\"r\\\\\"(.+?)>(.+?)<a href=\\\\\"(.+?)\\\\\" target=\\\\\"_blank\\\\\">(.+?)<\\\\/a>"; System.out.println(re); Pattern pattern = Pattern.compile(re); Matcher matcher = pattern.matcher(html); while (matcher.find()) { resultUrl.add(matcher.group(3).replace("\\/", "/").replace("&", "&").replace("&", "&")); System.out.println(matcher.group(3).replace("\\/", "/").replace("&", "&").replace("&", "&")); } return resultUrl; } }