下面是我在测试类写的代码:
String logEntry="tin";
String regexp="t[ael]n";
PatternCompiler compiler=new Perl5Compiler();
//我导包到不进来是不是要添加jar包啊!如果是在哪下载该jar包添加进去啊!Pattern pattern=compile.compile(regexp);
PatternMatcher matcher=new Perl5Matcher();
if(matcher.contains(logEntry.pattern)){
           MatchResult result=matcher.getMatch();
           System.out.println(result.group(1));
}