Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-02-06 02:30
Updated·2023-02-06 03:11
Flavor·ECMAScript (JavaScript)

/
^rgba?\((?:(?:(?:[0-9]{1,3} ){2}[0-9]{1,3}|(?:[0-9]{1,3}% ){2}[0-9]{1,3}%)(?: \/ (?:[0-9]{1,3}%|1|0|0?\.[0-9]+))?|(?:(?:[0-9]{1,3}, ){2}[0-9]{1,3}|(?:[0-9]{1,3}%, ){2}[0-9]{1,3}%)(?:, (?:[0-9]{1,3}%|1|0|0?\.[0-9]+))?)\)$
/
gm
Open regex in editor

Description

It validates the RGB expression doesn't break the CSS parser.

Submitted by Martin