Reputation: 3502
I have a string as:
word : 'A-Scan Ultrasonic'
How to match this with :
'A Scan Ultrasonic'
I have tried my luck as
{word:{$regex:".*A Scan Ultrasonic.*",$options: 'i'}}
But this doesn't fetch any result
May I know how this can be matched , any help is appreciated , TIA
Upvotes: 0
Views: 1087
Reputation: 1837
It's actually no mongo thing, you should use proper regex. Try with this:
{ name: { $regex: /.*A(-|\s)Scan(-|\s)Ultrasonic.*/}}
Upvotes: 1