Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by anniyan (Monk)
on Nov 25, 2005 at 14:41 UTC ( #511660=note: print w/ replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://511660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-09-04 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (148 votes), past polls