Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: On zero-width negative lookahead assertions

by ccn (Vicar)
on Sep 10, 2004 at 14:13 UTC ( [id://390077]=note: print w/replies, xml ) Need Help??


in reply to On zero-width negative lookahead assertions

there are two errors in the code:

  • @ and . must be backslashed
  • your \s* allows the regexp to match when \s* matches empty string
You are searching the match and Perl find it for you looking through all possible combinations

Replies are listed 'Best First'.
Re^2: On zero-width negative lookahead assertions
by bronto (Priest) on Sep 10, 2004 at 14:21 UTC
    @ and . must be backslashed

    Backslashed: still matches too much

    your \s* allows the regexp to match when \s* matches empty string

    I know it, I expressely want to match 0 or more spaces before line end

    Ciao!
    --bronto


    In theory, there is no difference between theory and practice. In practice, there is.

      Note the difference: perl -ne '/^root:(?!\s*admin\@somewhere\.here)/ and print' alliases

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-26 04:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found