regex not working for string “ahs():+ahs” let us know how we can search with . dot or other specials char
db.getCollection.find({“name” : { $regex :".ahs()- ,’ : +ahs. ", $options : “i”}})
For below query we are getting result.
db.getCollection(‘parameter’).find({“name” : { $regex :".ahs(). ", $
Asya_Kamsky
(Asya Kamsky)
September 24, 2021, 9:19pm
#2
Special characters in regular expressions have to be escaped if you want to search for them.
That’s not specific to MongoDB regular expressions. Try using \
(backslash) character before characters you want to match literally (like .
).
Asya
Hi Asya,
Thanks for replying back it is required to search a string which has. Dot in both either search criteria and database value.
system
(system)
Closed
October 6, 2021, 6:28am
#4
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.