RegexWars
Tier 4 · Enchantermatch

Hex Colours

Match a valid CSS hex colour — a # followed by exactly three or six hex digits, and nothing else.

Three or six, not four or five. A repeated group is the neat way to say that: a group of three, taken once or twice.

Your pattern0 chars · par 24
//
Flags
Start typing — tests run as you go.0 of 7 visible tests passing
Test cases
  • #fffmust match
  • #FFFFFFmust match
  • #a1b2c3must match
  • #ffffmust not match
  • #12345must not match
  • fffmust not match
  • #ggggggmust not match

+ 5 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.