Regular Expressions 101

Sponsors

Library entries

0
javascript

Password

Password regular expression
Submitted by AhbapAldırma - 6 hours ago
0
javascript

Certificate

Certificate
Submitted by anonymous - 13 hours ago
1
python

Parse Data Fields

Parsing example
Submitted by anonymous - a day ago
0
javascript

rwd

rwd
Submitted by anonymous - a day ago
0
javascript

Cbre bookingid

a
Submitted by anonymous - 2 days ago
0
pcre

get arrays from Json

get arrays from Json
Submitted by fawaz - 2 days ago
0
pcre2

Match CamelCase

Matches PascalCase or CamelCase
Submitted by anonymous - 3 days ago
0
pcre2

nr_classe

separação de um código numérico simples
Submitted by anonymous - 3 days ago
0
python

month with year extraction

ready code
Submitted by anonymous - 3 days ago

CSS Colors: RGB(A), HSL(A), HEX(3,4,6,8), var(--tw-color), etc...

Vote

2

Regular Expression
javascript

/
^\s*(color|background[-color]*||[a-zA-Z0-9-_]+)??[\s:=]*[\s]*(?:(\b(rgb)\s*?\(\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?\))|(\b(rgba)\s*?\(\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(000|0?\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\s*?,\s*?(0|0\.\d*|1|1.0*)\s*?\))\B|(\b(transparent)|(inherit)|(initial)|(currentColor)|(var)[(]([-]{2}[^)]+)[)])|(#([a-fA-F0-9]){3,4})|(#([a-fA-F0-9]){6,8})|(\b(hsl)\s*?\(\s*?(000|0?\d{1,2}|[1-2]\d\d|3[0-5]\d|360)\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?\)$)|(\b(hsla)\s*?\(\s*?(000|0?\d{1,2}|[1-2]\d\d|3[0-5]\d|360)\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(000|100|0?\d{2}|0?0?\d)%\s*?,\s*?(0|0\.\d*|1|1.0*)\s*?\)\b))
/
gm

Description

Loading markdown...
Submitted by Nicholas Berlette (@nberlette) - 2 months ago