regex hex color code example
Example 1: hex color regex
^#(?:[0-9a-fA-F]{3}){1,2}$
Example 2: how to write regex of hex code
regex = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
^#(?:[0-9a-fA-F]{3}){1,2}$
regex = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"