Fascinating! How right you are. JS
split does not work the same as Java split.
It's truly ugly.
alert( "ooo".split(/o/g) );
And you get a blank string.
APPARENTLY, the split *does* work, but then JS
decides that any null elements in the resultant array aren't really there and consolidates them out of existence.
I have *NEVER* seen this documented anywhere!!
Okay, it's not quite as compact, but it's still pretty simple:
var s = "oooooo";
var re = /o/g;
for( var c = 0; re.exec(s); ++c );