in reply to Can't figure out how to invert this regex

You are using variable length in negative look behind, as per the perl regex tutorial perlre, we cannot use variable length in negative look behind condition. Rather we can use variable length in positive and negative look ahead.

updated:Thanks sauoq and apologises for the mistake.

Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)

  • Comment on Re: Can't figure out how to invert this regex

Replies are listed 'Best First'.
Re^2: Can't figure out how to invert this regex
by sauoq (Abbot) on Nov 25, 2005 at 22:42 UTC
    Rather we can use variable length in positive look behind

    No, that's incorrect. Variable length patterns are supported in neither negative nor positive look-behind.

    -sauoq
    "My two cents aren't worth a dime.";
    
Re^2: Can't figure out how to invert this regex
by Anonymous Monk on Nov 25, 2005 at 14:51 UTC
    Ah... so:

    s/&(?!.{2,10}?;)/REPLACED/g;
    Gives me what i need. Thanks.