JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "[AB,,,CD,,,,,,EF]";
console.log(str.replace(/,(?=,)/g, ',null'));