Regular Expressions 101

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]), (25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]), (25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$
/
gm

Description

Standardized RGB 256 Notation for CSS Functions.

For Example:

const str = "255, 255, 255"; // Match const str = "0, 10, 200"; // Match const str = "300, 400, 500"; // Does -NOT- Match

Submitted by anonymous - 3 years ago