Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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("&amp;", "&").replace("&amp;", "&"));
            System.out.println(matcher.group(3).replace("\\/", "/").replace("&amp;", "&").replace("&amp;", "&"));

        }

        return resultUrl;
    }
}