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 <raffaboss / gmail.com> wrote:
> cannot use regex, i suppose:
>
> (.{aNumber}).*\1
>
>
>
> where aNumber = 2..x (x=text.length/2), until regex 'response' is
> 'nil'