50,504
社区成员
发帖
与我相关
我的任务
分享
package com.demo;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test07 {
public static void main(String[] args) {
List<String> result = new ArrayList<String>();
String REGEX_TIMESCALE = "06-Nov-2018 14:32:48.678 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/tomcat/apache-tomcat-8.5.34/webapps/manager] has finished in [103] ms";
Pattern pattern = Pattern.compile("(.*?\\s)");
Matcher matcher = pattern.matcher(REGEX_TIMESCALE);
while (matcher.find()) {
result.add(matcher.group(1));
}
System.out.println(result);
}
}