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

Published on Tue Mar 01 2022

Versatile, multiline matching of CSS colors of many common formats, including: - [x] HEX-3: `#123` (equivalent to `#112233`) - [x] HEX-4: `#FA0F` ( ... `#FFAA00FF`) - [x] HEX-6: `#FF3300` ( ...`#F30`) - [x] HEX-8: `#FFAA00FF` ( ...`#FA0F`) - [x] RGB: `rgb(0, 0, 0)` - [x] RGBA: `rgba(255, 255, 255, 1.0)` - [x] HSL: `hsl(100, 50%, 50%)` - [x] HSLA: `hsla(100, 20%, 20%, 1.0)` - [x] Vars: `var(--tw-color-name, #000000)` - [x] Misc: `color: inherit;` `color: currentColor;` `color: initial;`, etc. * With or without trailing semicolon or comma * Forgiving of whitespace issues * Allows property/declaration names (e.g. `color: #fff`), most other solutions do not.

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

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

Versatile, multiline matching of CSS colors of many common formats, including: - [x] HEX-3: `#123` (equivalent to `#112233`) - [x] HEX-4: `#FA0F` ( ... `#FFAA00FF`) - [x] HEX-6: `#FF3300` ( ...`#F30`) - [x] HEX-8: `#FFAA00FF` ( ...`#FA0F`) - [x] RGB: `rgb(0, 0, 0)` - [x] RGBA: `rgba(255, 255, 255, 1.0)` - [x] HSL: `hsl(100, 50%, 50%)` - [x] HSLA: `hsla(100, 20%, 20%, 1.0)` - [x] Vars: `var(--tw-color-name, #000000)` - [x] Misc: `color: inherit;` `color: currentColor;` `color: initial;`, etc. * With or without trailing semicolon or comma * Forgiving of whitespace issues * Allows property/declaration names (e.g. `color: #fff`), most other solutions do not.

Matching Multiline Strings in Large Text File

Need Help, Matching Multiline Strings in Large Text File

Color RegEx

Color RegEx

HTML color search

Searches for hex colors in HTML code.

html color match: transparent, #fff, #123456, rgb, rgba, hsl, hsla

This may be useful or not to test whether a given string is a valid (more or less) html color value. It matches color values such as: - #123 - short hex color value - #123456 - hex color value - rgb(255,255,0) - rgb color value - rgba(255,255,0,1.0) - rgba color value - hsl(360,100%,100%) - hsl color value - hsla(360,100%,100%,0.5334) - hsla color value Regex allows whitespaces between i.e. rgb and (, also between numbers and commas, but not in value like 55% between number and percentage. To change this behaviour simply remove \s*? from appriopriate places.

Date and time format - ISO 8601

Matches ISO 8601 date formats

Remove invalid characters and autotrim

remove the multiline switch

RGB colors

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

parse tag data with multiline

parse tag data with multiline

url match

match the most common url stuctures