Javascript Regular Expression for rgb values

后端 未结 9 1293
名媛妹妹
名媛妹妹 2020-12-18 21:15

I\'m trying to get the individual values of a rgb string. I\'ve been getting close, but I\'m just hitting a wall. I\'m looking to do something like this:

v         


        
9条回答
  •  感动是毒
    2020-12-18 21:41

    Try this. A regex within the range 0 - 255.

    rgb\((( *0*([1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]) *),){2}( *0*([1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]) *)\)
    

    Regular expression visualization

    Debuggex Demo

提交回复
热议问题