From: Niels Steves Date: 2012-04-01T03:58:39+09:00 Subject: Ruby regex match hex string Hey guys, I was wondering if someone could help me out. I'm trying to validate a string with a regex but can't get it working. I need to validate a string containing hex pairs divided by a comma, like this 11,1,aa,a,1b,3b,55,b6 I got this regex: /\A([0-9a-fA-F]{1,2},{1})*([0-9a-fA-F]{1,2}){1}\Z/ but it only validates the last two pairs, 55, and b6 It should't validate strings like this: 111 or strings like aaa,aaa,bob,ccc Can anybody help me out with some pointers? I'm new to using regex expressions. Thanks a lot! -- Posted via http://www.ruby-forum.com/.