Reputation: 43501
I am using JavaScript:
::add ::stuff more::word
I want to match ::add
and ::stuff
, but not ::word
.
How can I do this?
Upvotes: 0
Views: 53
Reputation: 70732
You can use a non-word boundary \B
here:
var r = '::add ::stuff more::word'.match(/\B::\w+/g);
console.log(r); //=> [ '::add', '::stuff' ]
Upvotes: 6