var array = ['rgba', {}], expr = 'rgba(255,255,255,0.9)'.match(/[\d.]+/g), i = expr.length; while(i--) { array[1][array[0].split(/\.*/)[i]] = expr[i]; } alert(array); //array.toSource(): ['rgba', {r:255, g:255, b:255, a:0.9}]