[Israel.pm] Regexp

Offer Kaye offer.kaye at gmail.com
Thu Jun 2 03:58:27 PDT 2005

On 6/2/05, Peter Gordon wrote:
> Suppose I have the text "HarryMaryJaneHarryxMaryJane" and I want to find
> the longest duplicate match.
> If I use /(.+).*?(\1)/
> it matches Harry, but the longest match is MaryJane.
> What is the best approach to this problem?

The was a Perl Quiz of The Week about this subject (finding the
longest repeating substring). The site (http://perl.plover.com/qotw/)
seems to be down at the moment, so I don't know which solution won,
but here is one solution I found using Google's cache:
(tiny URL: http://tinyurl.com/cpcof)

This is Google's cache of: 

Offer Kaye

More information about the Perl mailing list