In java this is possible
public static void main(String[] args) {
Matcher m = Pattern .compile("^(.*?[.].*?[.].*?[.].*?)[.].*")
.matcher(
"com.SEM.Google.Generico.space.test");
if (m.matches()) {
System.out.println(m.group(1));
}
}
This would give me as result: com.SEM.Google.Generico
If I have a string in mongodb
"dv" : "com.SEM.Google.Generico.space.test"
can I use the mongo aggregation framework somehow to get com.SEM.Google.Generico as result?
It should be as generic as possible. So not something like
$project: {
pathString: {
$substr: ["$path.dv", 0, 23]
}
}
Is this possible at all? Thanks.