in reply to japhy has met his match

Ok, updated AGAIN, thanks to MeowChow pointing out the obvious. ;)
123456789_123456789_123456789_123456789_123456789_123456 $re = q{^.*(??{$&ne'^.*(??{'.substr($re,7,-4).'})\z'&&'(?!)'})\z};


japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: japhy has met his match
by MeowChow (Vicar) on May 25, 2001 at 21:05 UTC
    Am I missing something?
    print q|^.*(??{ })\z| =~ m|^.*(??{$&ne'^.*(??{'.substr($&,7,36).'})\z'})\z| # outputs 1
    Update to japhy's update: In that case, why not simply:
    $re = q{^.*(??{$&ne$re&&'(?!)'})\z};
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
Re: Re: japhy has met his match
by Masem (Monsignor) on May 25, 2001 at 20:39 UTC
    Close, but not quite yet:

    First, here's a 5.005 version that's the same thing:

    $regex = '^(.*)(?(?{my$x=substr$1,9,-4;$1ne"^(.*)(?(?{$x}))\\z"}))\z';
    And here's the stinger:
    $test = '^(.*)(?(?{my$japhy;my$x=substr$1,9,-4;$1ne"^(.*)(??{$x}))\\z +"}))\z';
    (Mind you, I'm playing with this on 5.005, and things that I don't expect to match are matching - I wonder if there's a bug in the RE engine at this point. However, I'm pretty sure that adding any text prior to "my$x..." will still match...)

    I think that you need to specify the exact length of the substr that you're looking at, which means to just simply do some character counting.


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain