-
-
Save kevinreynolds/02277531c29b01f0599355858d4235e9 to your computer and use it in GitHub Desktop.
Regex for validating hexadecimal color codes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ | |
^ #start of the line | |
# # must constains a "#" symbols | |
( # start of group #1 | |
[A-Fa-f0-9]{6} # any strings in the list, with length of 6 | |
| # ..or | |
[A-Fa-f0-9]{3} # any strings in the list, with length of 3 | |
) # end of group #1 | |
$ #end of the line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment