I have a string named pageList= [[],[2567,2568,],[2569,2570,2571,2537,],[2538,2586,2587,2588,],[2589,2590,2591,2592,2593,]]
I need to remove the presnce of [], with (empty) and ,[] with (empty) and ,] with ] . I tried the code
pageList = pageList.replace(/,]/g,']');
pageList = pageList.replace(/[]/g,'');
pageList = pageList.replace(/[/]/g,'');
But its is replacing the ,] with ] but removing the ,[] and [], is not working.The output I am getting now is [[],[2567,2568],[2569,2570,2571,2537],[2538,2586,2587,2588],[2589,2590,2591,2592,2593]]