I have a String variable like that "/etc/opt/eset/esets/license/esets_abd9c6.lic: ESET File Security, 2019-07-29 00:00:00, Mynet"
and I need to capture the date value from that field, but I couldn't figure it out.
String string = "/etc/opt/eset/esets/license/esets_abd9c6.lic: ESET File Security, 2019-07-29 00:00:00, Mynet";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Pattern p = Pattern.compile("");
Matcher m = p.matcher(input);
Date tempDate = null;
if(m.find())
{
tempDate = format.parse(m.group());
}
System.out.println("" + tempDate);
Is there any regex pattern for capturing a date value from a String vaiable?