Regex to match R-G-B and Opacity with/without "," and even RGBA text It will match rgba(x,x,x,x.x) rgba (x x X x.x) x,x,x,x.x x x x x.x