var str = '[1, 2][3, 6]'; str = str.match(/\d+/g); str = [ [str[0], str[1]], [str[2], str[3]] ] alert( str );