Ruby has really a problem with 'duplicate'. I must say that I've found
 very strange the rules used by the regexp engine in this case.

 Another example

pigeon% ruby -e 'puts "OK" if /(a)*-\1b/ =~ "aaa-b"'
OK
pigeon% 


Guy Decoux