From: SERGEY VOLKOV Date: 2008-01-24T03:21:31+09:00 Subject: Re: Longest Repeated Substring (#153) Why not? The simplest solution could be: def longest_repeated_substring str (str.size/2).downto(1) { |i| /(.{#{i}}).*\1/m =~ str and return $1 } nil end but it's too slow; On Jan 23, 2008 12:35 PM, Raffa wrote: > cannot use regex, i suppose: > > (.{aNumber}).*\1 > > > > where aNumber = 2..x (x=text.length/2), until regex 'response' is > 'nil'