Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static List<String> findAllMatches(String regularExpression, String contentsString) {
        List<String> allMatches = new ArrayList<String>();
        Matcher m = Pattern.compile(regularExpression).matcher(contentsString);
        while (m.find()) {
            allMatches.add(m.group());
        }
        return allMatches;
    }
}