in reply to TOOWTDI (There's Only One Way To Do It)

In theory, the following should also work, but Perl doesn't like it one bit:
(sort{length$b<=>length$a}pop=~/.*(?(?{$&=~'(.).*\1'})^)/gs)[0]
update: blech, actually in theory it wouldn't work since i'm not using a zero-width assertion for remainder of the matched strings, but it's still interesting that it segfaults Perl.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: TOOWTDI (There's Only One Way To Do It)
by japhy (Canon) on Jun 06, 2001 at 01:05 UTC
    Let me guess... segfault? ;) A lot of approaches I wanted to take ended up screwing up Perl, because they used a regex in a regex, and that greatly upset the engine.

    japhy -- Perl and Regex Hacker