Regular expressions pcre2 · Common patterns

Hex colour

Match both the short #fff and the long #ffffff forms.

#(?:[0-9a-fA-F]{3}){1,2}\b

Official Regular expressions pcre2 documentation

More common patterns commands

All common patterns commands · Regular expressions pcre2 cheatsheet

Was this page helpful?