How to match a string consisting special character like hyphen and spaces

后端 未结 1 1954
忘了有多久
忘了有多久 2021-01-27 05:59

I have a string as:

word : \'A-Scan Ultrasonic\'

How to match this with :

   \'A Scan Ultrasonic\'

I have tri

1条回答
  •  走了就别回头了
    2021-01-27 06:19

    It's actually no mongo thing, you should use proper regex. Try with this:

    { name: { $regex: /.*A(-|\s)Scan(-|\s)Ultrasonic.*/}}
    

    0 讨论(0)
提交回复
热议问题