Regular Expressions 101

Sponsors

Library entries

1
javascript

RegEx Workshop

Phone Number RegEx
Submitted by Anthony Cooper - 10 months ago
1
javascript

Add rgb for colour variables

Add rgb for colour variables
Submitted by anonymous - 10 months ago
1
javascript

Third Strike - SRK Wiki - Any Guard Type

xxx
Submitted by Clay Dunston - 10 months ago
1
javascript

CSV CIDR subnets

Comma separated CIDR network addresses
Submitted by Glenn - 9 months ago
1
python

Don't match numbers longer than 5 length

using ^ and $
Submitted by anonymous - 9 months ago
1
python

ss001

Rep
Submitted by anonymous - 9 months ago
1
javascript

hashtag

gfhgfhghfg
Submitted by anonymous - 9 months ago
1
java

11

11
Submitted by 11 - 9 months ago
1
javascript

1

1
Submitted by anonymous - 8 months ago
1
python

Remove HTML tags and comments

Remove HTML tags and comments
Submitted by Smit Patel - 8 months 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) - 7 months ago