Regex Cheatsheet - Regular Expression Quick Reference

Quick reference for regular expression patterns. Character classes, quantifiers, anchors, and common patterns.

Share
Back to Regex Cheatsheet

Hex Color Pattern

Common Pattern

Match CSS hex color (#RGB, #RRGGBB, #RRGGBBAA)

Pattern

^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$

Examples

#FFF

Short white

Matches: #FFF

#FF5733

Standard 6-digit

Matches: #FF5733

#FF5733AA

With alpha

Matches: #FF5733AA

Related Patterns

Related Tools

More Text Tools