From: Avdi Grimm Date: 2008-11-03T06:56:48+09:00 Subject: Re: check if valid hexadecimal code? On Sun, Nov 2, 2008 at 4:30 PM, Chealsea S. wrote: > How would you check if a string is a valid hexadecimal code? irb(main):007:0> hex_pattern = /^[[:xdigit:]]+$/ => /^[[:xdigit:]]+$/ irb(main):008:0> hex_pattern === "0123456789ABCDEF" => true irb(main):009:0> hex_pattern === "Chunky Bacon" => false -- Avdi Home: http://avdi.org Developer Blog: http://avdi.org/devblog/ Twitter: http://twitter.com/avdi Journal: http://avdi.livejournal.com