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 getDateFromString(String content) {
        try {
            String strPattern = "DB_PoliceOfficeWork_(\\d{4}-\\d{2}-\\d{2}).db";
            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 "";
    }
}