Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static String getOneStrFromString(String strPattern, String content) {
        try {
            Pattern pattern = Pattern.compile(strPattern);
            Matcher matcher = pattern.matcher(content);
            while (matcher.find()) {
                return matcher.group(1);
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "";
    }
}