Community Patterns

Community Library Entry

1

Regular Expression
Created·2022-04-23 03:39
Updated·2022-04-25 03:51
Flavor·ECMAScript (JavaScript)

/
^#([A-F0-9]{3}){1,2}$
/
igm
Open regex in editor

Description

Matches against RGB (not to be confused with RGBa). Will match against any and all RGB Hexadecimal Formatted colors. Some example of the values this regular expression was created to match are: "#FFFFFF", "#FFF", "#ABCDEF", "#123456", "#18F", "#812"

MUST USE THE 'i' FLAG (insensitive)

Without the i flag the regular expression will only match against colors formatted with all uppercase letters.

Submitted by jD3V