This Regex is working in mongo query as below :
{$match : {'file_details.tec_stop' : {$regex : /(\d\|){1}\d/}}},
but now working when using java :
String stopRegex="/(\\d\\|){"+stops+"}\\d/";
pipeline.add(new BasicDBObject("$match", new BasicDBObject("file_details.tec_stop'", new BasicDBObject("$regex", stopRegex))));
What's the issue?
Pattern.quote(stops)and use the result instopRegex.