From: "Jan E." Date: 2012-04-01T04:31:50+09:00 Subject: Re: Ruby regex match hex string Hi, What makes you think that only the last two pairs are matched? This is impossible, because you're using the \A and \Z anchors. Either the whole string matches or it doesn't match at all. The regex is actually correct and it does match the example string. However, you can leave out the {1} quantifier, because it has no effect (it means repeating the pattern exactly once). And you can make the regex shorter by using the "i" modifier, which makes it case insensitive: /\A(?:[0-9a-f]{1,2},)*[0-9a-f]{1,2}\z/i -- Posted via http://www.ruby-forum.com/.