Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] argv) throws Exception {

        Pattern pattern = Pattern.compile("pattern");
        Matcher matcher = pattern.matcher("infile.txt");

        // Find all matches
        while (matcher.find()) {
            // Get the matching string
            String match = matcher.group();
        }
    }
}