regex for hexidecimals code example Example: how to write regex of hex code regex = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"