Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static <T extends Collection<String>> T findAll(String regex, String content, int group, T collection) {
        Matcher matcher = Pattern.compile(regex, Pattern.MULTILINE).matcher(content);
        while (matcher.find()) {
            collection.add(matcher.group(group));
        }
        return collection;
    }
}