[Israel.pm] Regexp

Shlomi Fish shlomif at iglu.org.il
Thu Jun 2 02:15:58 PDT 2005


I recall a Perl Quiz-of-the-Week about it. They said that it could be done 
using a suffix tree.

Regards,

	Shlomi Fish

On Thursday 02 June 2005 11: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?

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

Tcl is LISP on drugs. Using strings instead of S-expressions for closures
is Evil with one of those gigantic E's you can find at the beginning of 
paragraphs.



More information about the Perl mailing list