From: Brian Candler Date: 2009-06-01T17:44:59+09:00 Subject: Re: Regular expression 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/.