Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: how to find what's not there with a regex?

by samizdat (Vicar)
on Aug 24, 2005 at 14:58 UTC ( [id://486221]=note: print w/replies, xml ) Need Help??


in reply to Re^3: how to find what's not there with a regex?
in thread how to find what's not there with a regex?

hmmm.... (?! xyz ) { what-bang? :) }

New one on me, but that's an excellent idea.

Stop when you see xyz...

Perl++ never ceases to amaze me.
  • Comment on Re^4: how to find what's not there with a regex?

Replies are listed 'Best First'.
Re^5: how to find what's not there with a regex?
by ikegami (Patriarch) on Aug 24, 2005 at 15:15 UTC

    It's the zero-width negative lookahead operator. In English, it means "not immediately followed by", and it doesn't move pos, so the next item in the regexp will start matching as if the (?!...) wasn't there.

    It's almost always used as
    (?: (?! ...regexp... ) .)*
    or
    (?: (?! ...regexp... ) .)+
    Anything else is should be very carefully inspected.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-24 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found