I would highly appreciate it if someone can point me in the right direction on this. I have an array “cArr” and within this array I have 2 elements. What I would like to do is to match the “rgb(xx,xx,xx)”and push it to an array “rgbArr”; The issue that I am encountering is with regEx.
Here is my code:
var cArr = ["id0{shape:round,rgb(24,23,12)}","id1{shape:long,weight:heavy,rgb(20,20,20)}","id2{shape:elongated,weigth:light,rgb(15,24,8)}"];
for(var i=cArr.length -1; i>=0; i--)
{
if(cArr[i].match(matchColors))
{
rgbArr.push(cArr[i]);
break;
}
}
console.log(rgbArr);
Please clarify your question (seem my comment above), for the time being try something like this. (But this doesn’t give you the multiple rgb colors in the 1st element…)