Created
March 16, 2013 22:45
-
-
Save topdown/5178652 to your computer and use it in GitHub Desktop.
Regex validate hex color. Validates the hex color value skipping over non-valid values.
This file contains hidden or 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
\b(?<=#)(([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}))\b | |
#333333 = valid | |
#abcde0 = valid | |
#333 = valid | |
#4 = not valid | |
#44 = not valid | |
#4444 = not valid | |
#44444 = not valid | |
#4444444 = not valid | |
#33333g = not valid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment