This gives null because '/[,]/i' is not a regex. As explained at the MDN, if a non-regex is passed to string.match, then it will be converted to a regex using new Regex(obj).
What you want is to pass the actual regex object, /[,]/i (or simply /,/i). "1,2,3".match(/,/i) will work as you expect in terms of matching.
However, as Cybernate pointed out, a regex is overkill for this kind of problem. A better solution is to split the string:
var str = "1,2,3,4,5";
var len = str.split(",").length - 1;