I want to search values having special characters such as "(" in a document. I 'm using following criteria in mongoose and fetch the names that matches like "abc (pvt) ltd".
var criteria = {};
criteria.name = new RegExp(searchPrameters.name, "i");
I found the solution with replacing of the parenthesis using string.replace() function.
searchPrameters.name = searchPrameters.name.replace('(','\\(');
searchPrameters.name = searchPrameters.name.replace(')','\\)');