my logs looks like this. And when I use “\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}” as regex expression in following java code, it could extract timestamp 2021-05-22 10:51:20.277
String logs="[GORAL][lieng][2021-05-22 10:51:20.277][xxx-thread-10][DEBUG][c.x.g.g.t.rfm.Rfm][275] - xxxx ]"
symbol = "";
Pattern pattern3 = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}");
Matcher matcher3 = pattern3.matcher(logs);
if (matcher3.find()) {
symbol = matcher3.group();
}
log.debug("symbol: {}", symbol);
but when I give this regex in the extractor, it shows me “regular expression doesnot contain any math”
Any suggestions?
I noticed that your post did not receive any responses. Have you checked out this previous solution to a similar issue. Please let me know if this help. Your question is important to the community.