Skip to content

Instantly share code, notes, and snippets.

@LunaCodeGirl
Created February 1, 2014 01:43

Revisions

  1. LunaCodeGirl created this gist Feb 1, 2014.
    11 changes: 11 additions & 0 deletions HexadecimalColorRegex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ^#([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