I have a regex which splits a string into an array at every space and keeps the space value in each occurrence as follows:
var str = "[This is a test]";
var foo = str.toLowerCase().split(/(\S+\s+)/).filter(function(n) {return n});
This returns the following on all modern browsers:
["[This ", "is ", "a ", "test]"];
But on IE8 all I get is ["test]"];
It seems that IE8 doesn't read the \S
regex character correctly. Does anyone know of a workaround for IE8 to reproduce the correct array?
Thanks