Regular Expressions 101

Library entries

Valid RGB color value

Vote

1

Regular Expression
javascript

/
^rgba?\((?:\s+)?(?<r>\d+(?<unit>%?))(?:\s+)?(?<separator>[\s|,])(?:\s+)?(?<g>\d+\k<unit>)(?:\s+)?\k<separator>(?:\s+)?(?<b>\d+\k<unit>)(?:\s+)?(?:(?<=(?:,.+))(?:,(?:\s+)?(?<a>(?:\d+)?(?:\.?\d+)))?(?:\s+)?)?\)$
/
gm

Description

Loading markdown...
Submitted by BorisTB - 2 months ago