\h is the ruby โโregular expression code for hex. (...) captures the load, and \1 allows you to refer to the first profile:
/
in irb:
>> %w{ #000000 #ababab #ffffff #ccddcc #afafa0 }.map { |s| s =~ /#(\h\h)\1\1/ } => [0, 0, 0, nil, nil]
rampion
source share