Extract CSS-like hex color literals.
Section: JavaScript Recipes
Find hex colors
javascript
javascript
/#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})\b/gExplanation
Covers 3, 6, and 8 digit forms.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing JavaScript Recipes
Collapse internal whitespace
Normalize repeated whitespace down to single spaces.
Basic semver parser
Extract version parts from a semantic version string.