[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:
http://66.102.9.104/search?q=cache:mCDPb_-vXBAJ:perl.plover.com/qotw/misc/e014/progs/baringer1.pl
(tiny URL: http://tinyurl.com/cpcof)
This is Google's cache of:
http://perl.plover.com/qotw/misc/e014/progs/baringer1.pl
HTH,
--
Offer Kaye
More information about the Perl
mailing list