Regular expression to match all search terms

后端 未结 3 457
逝去的感伤
逝去的感伤 2021-01-25 00:47

I need a regular expression that will match on all terms in a set of search terms. If the user types \"bat sun\" then I need to match any text entries that have words starting w

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-25 00:59

    Probably a regex like below if you really want to use regex:

    (?=.*\bsun)(?=.*\bbat).*
    

    Of course you want to make it ignore case.

提交回复
热议问题