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> getResultContent(String html) { ArrayList<String> resultContent = new ArrayList<String>(); String re = "<div class=\"sort_name_detail\"><a href=\"(.+?)\" target=\"_blank\" title=\"(.+?)\">"; Pattern pattern = Pattern.compile(re); Matcher matcher = pattern.matcher(html); while (matcher.find()) { resultContent.add(matcher.group(2).replace("\n", "").replace(" ", "").replace("\t", "") .replace("<b>", "").replace("</b>", "")); System.out.println(matcher.group(2)); } return resultContent; } }