In Javascript :
var myString = "This is my string";
console.log(myString.split(/(\s)/));
Output : ["This", " ", "is", " ", "my", " ", "string"]
console.log(myString.split(/\s/));
Output : ["This", "is", "my", "string"]
Why is this happening ?