Regex match entire words only

后端 未结 7 1342
挽巷
挽巷 2020-11-21 05:35

I have a regex expression that I\'m using to find all the words in a given block of content, case insensitive, that are contained in a glossary stored in a database. Here\'s

7条回答
  •  时光取名叫无心
    2020-11-21 06:04

    Get all "words" in a string

    /([^\s]+)/g

    Basically ^/s means break on spaces (or match groups of non-spaces)
    Don't forget the g for Greedy

提交回复
热议问题