Javascript Regex for all words not between certain characters

后端 未结 3 1747
借酒劲吻你
借酒劲吻你 2021-01-17 04:44

I\'m trying to return a count of all words NOT between square brackets. So given ..

[don\'t match these words] but do match these

I get a c

3条回答
  •  [愿得一人]
    2021-01-17 05:16

    I would use something like \[[^\]]*\] to remove the words between square brackets, and then explode by spaces the returned string to count the remaining words.

提交回复
热议问题