Brackets are the reason. Heres what MDN says string.split :
If separator is a regular expression containing brackets for parentheses, then each time the separator is matched, the results (including any undefined results) of the brackets for writing are combined into an output array.
They also warn:
However, not all browsers support this feature.
Thus, this result may be inconsistent. If you just want to separate the contents of the content, remove the parentheses:
>> 'test.thing.other'.split(/[az]+\./) ["", "", "other"]
Which may also not be what you want, but it is the expected result that has received your expression.
If you want to divide by dots, you need to specify this exactly in the regular expression: dot.
>> 'test.thing.other'.split(/\./) ["test", "thing", "other"]
source share