Javascript reg ex to match whole word only, bound only by whitespace

前端 未结 5 1307
轮回少年
轮回少年 2020-12-03 02:58

so I know \\bBlah\\b will match a whole Blah, however it will also match Blah in \"Blah.jpg\" I don\'t want it to. I want to match only whole words with a space on either

5条回答
  •  执念已碎
    2020-12-03 03:06

    extracting all words in a string

    words_array = str.match(/\b(\w|')+\b/gim)   //only single qout allowed
    

提交回复
热议问题