Mark Kremer wrote: > I'm not sure if you still want the regex, but following regex should do > the trick: ^(.{1})(?!\1)(.{1})(?!\1|\2).{1}\2$ Which is the same as the one I posted in my initial reply: irb(main):009:0> /^(.)(?!\1)(.)(?!\1|\2)(.)(\2)$/ =~ "abcb" => 0 irb(main):010:0> /^(.)(?!\1)(.)(?!\1|\2)(.)(\2)$/ =~ "abbb" => nil -- Posted via http://www.ruby-forum.com/.