In Javascript :
var myString = \"This is my string\";
console.log(myString.split(/(\\s)/));
Output : [\"This\", \" \", \"is\", \" \"
If you use a "capturing" group for the split pattern then the assumption is that probably you're interested in the group and therefore Javascript adds the group to the result.
If for example you use a "non-capturing" group instead then the result of the split is the same as when not using a group at all..
"This is my string".split(/(?:\s)/) → ["This", "is", "my", "string"]
Indeed there can be cases in which you may need a capturing group for the match (e.g. if you need a back-reference) but you're not interested in the separators. The workaround in those cases is to simply keep every other element of the result.