Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
String.prototype.split() with a regex with grouping ( parentheses ). #3467
Splitting a string normally leaves out the delimiters.
But grouping-parentheses in a regular expression preserves them in the odd-numbered indexes of the output.
This was not supported in IE before version 11. And MDN says "not all browsers support this capability." I'd like to see whether other browsers support this feature. But the current information in caniuse.com does not address this.