Regular Expressions 101

Community Patterns

RGB colors

1

Regular Expression
PCRE (PHP <7.3)

/
#([a-fA-F0-9]{3})([a-fA-F0-9]{3})?(?=\W?)
/
g

Description

Matches all the RGB colors in the format #RRGGBB and #RGB

Submitted by Gabriel Hautclocq - 9 years ago