I have tried below lines of code to get result of matching hotel name using Mongo regex in PHP format. But am not getting how to escape special characters:
$filter_array = array_merge($filter_array,
array('name' => array('$regex' => new MongoRegex("/".$hotel_name."/i"))));
Through this I am getting output for matching hotels but if suppose hotel name is like "ABC ( 3 Stars)" then am unable to get result for this kind of hotels as this hotel name is having special character "(" and ")".
How to escape such special character in hotel name?